This is an automated email from the ASF dual-hosted git repository. colegreer pushed a commit to branch 3.7-dev in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit c5c9baa86b355d11808e80a380c5076580a32bf6 Merge: e39ef4fcce 0b8b7ec4c5 Author: Cole-Greer <cole.gr...@improving.com> AuthorDate: Mon Mar 25 15:26:49 2024 -0700 Merge branch '3.6-dev' into 3.7-dev CHANGELOG.asciidoc | 1 + .../Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs | 2 +- .../apache/tinkerpop/gremlin/driver/Client.java | 5 +- .../tinkerpop/gremlin/driver/RequestOptions.java | 30 ++++++++ .../driver/remote/DriverRemoteConnection.java | 27 +------ .../driver/remote/DriverRemoteConnectionTest.java | 5 +- gremlin-go/driver/cucumber/gremlin.go | 2 +- .../gremlin-javascript/test/cucumber/gremlin.js | 2 +- gremlin-python/src/main/python/radish/gremlin.py | 2 +- .../server/ClientWithOptionsIntegrateTest.java | 87 ++++++++++++++++++++++ .../gremlin/test/features/map/Select.feature | 2 +- 11 files changed, 130 insertions(+), 35 deletions(-) diff --cc gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs index e520b2b328,bf7e01c810..b10a2db7ab --- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs +++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/Gremlin.cs @@@ -1164,7 -892,7 +1164,7 @@@ namespace Gremlin.Net.IntegrationTest.G {"g_withStrategiesXProductiveByStrategyX_V_asXaX_selectXaX_byXageX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithStrategies(new ProductiveByStrategy(productiveKeys: new List<object> {})).V().As("a").Select<object>("a").By("age")}}, {"g_withSideEffectXk_nullX_injectXxX_selectXkX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.WithSideEffect("k",null).Inject("x").Select<object>("k")}}, {"g_V_out_in_selectXall_a_a_aX_byXunfold_name_foldX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.AddV("A").Property("name","a1").As("a1").AddV("A").Property("name","a2").As("a2").AddV("A").Property("name","a3").As("a3").AddV("B").Property("name","b1").As("b1").AddV("B").Property("name","b2").As("b2").AddV("B").Property("name","b3").As("b3").AddE("ab").From("a1").To("b1").AddE("ab").From("a2").To("b2").AddE("ab").From("a3").To( [...] -- {"g_V_asXlabelX_aggregateXlocal_xX_selectXxX_selectXlabelX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().As("label").Aggregate(Scope.Local,"x").Select<object>("x").Select<object>("label")}}, ++ {"g_V_asXlabelX_aggregateXlocal_xX_selectXxX_selectXlabelX", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().As("label").Aggregate(Scope.Local,"x").Barrier().Select<object>("x").Select<object>("label")}}, {"g_V_shortestPath", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Identity().ShortestPath()}}, {"g_V_both_dedup_shortestPath", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Both().Dedup().ShortestPath()}}, {"g_V_shortestPath_edgesIncluded", new List<Func<GraphTraversalSource, IDictionary<string, object>, ITraversal>> {(g,p) =>g.V().Identity().ShortestPath().With("~tinkerpop.shortestPath.includeEdges")}}, diff --cc gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java index 63d7dad91a,cd5c2b68e0..f439157999 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java @@@ -18,13 -18,22 +18,23 @@@ */ package org.apache.tinkerpop.gremlin.driver; -import org.apache.tinkerpop.gremlin.driver.message.RequestMessage; +import org.apache.tinkerpop.gremlin.util.message.RequestMessage; + import org.apache.tinkerpop.gremlin.process.traversal.Bytecode; + import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.OptionsStrategy; + import org.apache.tinkerpop.gremlin.process.traversal.util.BytecodeHelper; import java.util.HashMap; + import java.util.Iterator; import java.util.Map; import java.util.Optional; import java.util.UUID; -import static org.apache.tinkerpop.gremlin.driver.Tokens.ARGS_BATCH_SIZE; -import static org.apache.tinkerpop.gremlin.driver.Tokens.ARGS_EVAL_TIMEOUT; -import static org.apache.tinkerpop.gremlin.driver.Tokens.ARGS_USER_AGENT; -import static org.apache.tinkerpop.gremlin.driver.Tokens.REQUEST_ID; ++import static org.apache.tinkerpop.gremlin.util.Tokens.ARGS_BATCH_SIZE; ++import static org.apache.tinkerpop.gremlin.util.Tokens.ARGS_EVAL_TIMEOUT; ++import static org.apache.tinkerpop.gremlin.util.Tokens.ARGS_MATERIALIZE_PROPERTIES; ++import static org.apache.tinkerpop.gremlin.util.Tokens.ARGS_USER_AGENT; ++import static org.apache.tinkerpop.gremlin.util.Tokens.REQUEST_ID; + /** * Options that can be supplied on a per request basis. * @@@ -88,6 -93,24 +98,26 @@@ public final class RequestOptions return new Builder(); } + public static RequestOptions getRequestOptions(final Bytecode bytecode) { + final Iterator<OptionsStrategy> itty = BytecodeHelper.findStrategies(bytecode, OptionsStrategy.class); + final Builder builder = RequestOptions.build(); + while (itty.hasNext()) { + final OptionsStrategy optionsStrategy = itty.next(); + final Map<String,Object> options = optionsStrategy.getOptions(); + if (options.containsKey(ARGS_EVAL_TIMEOUT)) + builder.timeout(((Number) options.get(ARGS_EVAL_TIMEOUT)).longValue()); + if (options.containsKey(REQUEST_ID)) + builder.overrideRequestId((UUID) options.get(REQUEST_ID)); + if (options.containsKey(ARGS_BATCH_SIZE)) + builder.batchSize(((Number) options.get(ARGS_BATCH_SIZE)).intValue()); + if (options.containsKey(ARGS_USER_AGENT)) + builder.userAgent((String) options.get(ARGS_USER_AGENT)); ++ if (options.containsKey(ARGS_MATERIALIZE_PROPERTIES)) ++ builder.materializeProperties((String) options.get(ARGS_MATERIALIZE_PROPERTIES)); + } + return builder.create(); + } + public static final class Builder { private Map<String,String> aliases = null; private Map<String, Object> parameters = null; diff --cc gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java index dd0a9259f6,831c606e96..ee2364ec44 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java @@@ -38,12 -33,7 +33,12 @@@ import java.util.Optional import java.util.UUID; import java.util.concurrent.CompletableFuture; +import static org.apache.tinkerpop.gremlin.util.Tokens.ARGS_BATCH_SIZE; +import static org.apache.tinkerpop.gremlin.util.Tokens.ARGS_EVAL_TIMEOUT; +import static org.apache.tinkerpop.gremlin.util.Tokens.ARGS_USER_AGENT; +import static org.apache.tinkerpop.gremlin.util.Tokens.REQUEST_ID; +import static org.apache.tinkerpop.gremlin.util.Tokens.ARGS_MATERIALIZE_PROPERTIES; - + import static org.apache.tinkerpop.gremlin.driver.RequestOptions.getRequestOptions; /** * A {@link RemoteConnection} implementation for Gremlin Server. Each {@code DriverServerConnection} is bound to one diff --cc gremlin-go/driver/cucumber/gremlin.go index 354891c4d3,f67e22056d..677a4dd2fb --- a/gremlin-go/driver/cucumber/gremlin.go +++ b/gremlin-go/driver/cucumber/gremlin.go @@@ -1135,7 -863,7 +1135,7 @@@ var translationMap = map[string][]func( "g_withStrategiesXProductiveByStrategyX_V_asXaX_selectXaX_byXageX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithStrategies(gremlingo.ProductiveByStrategy(gremlingo.ProductiveByStrategyConfig{ProductiveKeys: []string{}})).V().As("a").Select("a").By("age")}}, "g_withSideEffectXk_nullX_injectXxX_selectXkX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.WithSideEffect("k", nil).Inject("x").Select("k")}}, "g_V_out_in_selectXall_a_a_aX_byXunfold_name_foldX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.AddV("A").Property("name", "a1").As("a1").AddV("A").Property("name", "a2").As("a2").AddV("A").Property("name", "a3").As("a3").AddV("B").Property("name", "b1").As("b1").AddV("B").Property("name", "b2").As("b2").AddV("B").Property("name", "b3").As("b3").AddE("ab").From("a1").To("b1").AddE("ab").From("a2").To("b2").AddE("ab").From(" [...] -- "g_V_asXlabelX_aggregateXlocal_xX_selectXxX_selectXlabelX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().As("label").Aggregate(gremlingo.Scope.Local, "x").Select("x").Select("label")}}, ++ "g_V_asXlabelX_aggregateXlocal_xX_selectXxX_selectXlabelX": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().As("label").Aggregate(gremlingo.Scope.Local, "x").Barrier().Select("x").Select("label")}}, "g_V_shortestPath": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Identity().ShortestPath()}}, "g_V_both_dedup_shortestPath": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Both().Dedup().ShortestPath()}}, "g_V_shortestPath_edgesIncluded": {func(g *gremlingo.GraphTraversalSource, p map[string]interface{}) *gremlingo.GraphTraversal {return g.V().Identity().ShortestPath().With("~tinkerpop.shortestPath.includeEdges")}}, diff --cc gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js index 8054279e72,b82c018dee..fe3804f3a0 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/gremlin.js @@@ -1155,7 -882,7 +1155,7 @@@ const gremlins = g_withStrategiesXProductiveByStrategyX_V_asXaX_selectXaX_byXageX: [function({g}) { return g.withStrategies(new ProductiveByStrategy({productiveKeys:[]})).V().as("a").select("a").by("age") }], g_withSideEffectXk_nullX_injectXxX_selectXkX: [function({g}) { return g.withSideEffect("k",null).inject("x").select("k") }], g_V_out_in_selectXall_a_a_aX_byXunfold_name_foldX: [function({g}) { return g.addV("A").property("name","a1").as("a1").addV("A").property("name","a2").as("a2").addV("A").property("name","a3").as("a3").addV("B").property("name","b1").as("b1").addV("B").property("name","b2").as("b2").addV("B").property("name","b3").as("b3").addE("ab").from_("a1").to("b1").addE("ab").from_("a2").to("b2").addE("ab").from_("a3").to("b3") }, function({g}) { return g.V().as("a").out().as("a").in_().as("a"). [...] -- g_V_asXlabelX_aggregateXlocal_xX_selectXxX_selectXlabelX: [function({g}) { return g.V().as("label").aggregate(Scope.local,"x").select("x").select("label") }], ++ g_V_asXlabelX_aggregateXlocal_xX_selectXxX_selectXlabelX: [function({g}) { return g.V().as("label").aggregate(Scope.local,"x").barrier().select("x").select("label") }], g_V_shortestPath: [function({g}) { return g.V().identity().shortestPath() }], g_V_both_dedup_shortestPath: [function({g}) { return g.V().both().dedup().shortestPath() }], g_V_shortestPath_edgesIncluded: [function({g}) { return g.V().identity().shortestPath().with_("~tinkerpop.shortestPath.includeEdges") }], diff --cc gremlin-python/src/main/python/radish/gremlin.py index a17343d8b8,5d0e7b78bf..70c1751a5c --- a/gremlin-python/src/main/python/radish/gremlin.py +++ b/gremlin-python/src/main/python/radish/gremlin.py @@@ -1137,7 -864,7 +1137,7 @@@ world.gremlins = 'g_withStrategiesXProductiveByStrategyX_V_asXaX_selectXaX_byXageX': [(lambda g:g.withStrategies(*[TraversalStrategy('ProductiveByStrategy',{'productiveKeys':[],'strategy':'org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.ProductiveByStrategy'}, 'org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.ProductiveByStrategy')]).V().as_('a').select('a').by('age'))], 'g_withSideEffectXk_nullX_injectXxX_selectXkX': [(lambda g:g.withSideEffect('k',None).inject('x').select('k'))], 'g_V_out_in_selectXall_a_a_aX_byXunfold_name_foldX': [(lambda g:g.addV('A').property('name','a1').as_('a1').addV('A').property('name','a2').as_('a2').addV('A').property('name','a3').as_('a3').addV('B').property('name','b1').as_('b1').addV('B').property('name','b2').as_('b2').addV('B').property('name','b3').as_('b3').addE('ab').from_('a1').to('b1').addE('ab').from_('a2').to('b2').addE('ab').from_('a3').to('b3')), (lambda g:g.V().as_('a').out().as_('a').in_().as_('a').select(Pop.all_, [...] -- 'g_V_asXlabelX_aggregateXlocal_xX_selectXxX_selectXlabelX': [(lambda g:g.V().as_('label').aggregate(Scope.local,'x').select('x').select('label'))], ++ 'g_V_asXlabelX_aggregateXlocal_xX_selectXxX_selectXlabelX': [(lambda g:g.V().as_('label').aggregate(Scope.local,'x').barrier().select('x').select('label'))], 'g_V_shortestPath': [(lambda g:g.V().identity().shortestPath())], 'g_V_both_dedup_shortestPath': [(lambda g:g.V().both().dedup().shortestPath())], 'g_V_shortestPath_edgesIncluded': [(lambda g:g.V().identity().shortestPath().with_('~tinkerpop.shortestPath.includeEdges'))],