[ 
https://issues.apache.org/jira/browse/TINKERPOP-2128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17791387#comment-17791387
 ] 

ASF GitHub Bot commented on TINKERPOP-2128:
-------------------------------------------

kenhuuu commented on code in PR #2367:
URL: https://github.com/apache/tinkerpop/pull/2367#discussion_r1410021697


##########
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ExplainStrategyTest.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import 
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
+import 
org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.InjectStep;
+import 
org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.CountStrategy;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
+import org.junit.Test;
+
+import static 
org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalSource.traversal;
+import static org.junit.Assert.assertTrue;
+
+public class ExplainStrategyTest {
+
+    private static final GraphTraversalSource g = 
traversal().withEmbedded(EmptyGraph.instance()).
+            withStrategies(CountStrategy.instance(), 
ReferenceElementStrategy.instance());
+
+    @Test
+    public void shouldModifyTraversal() {
+        final Traversal<Vertex, ?> t = 
g.withStrategies(ExplainStrategy.instance()).V().limit(1).count().is(0);
+
+        final String explanation = (String) t.next();

Review Comment:
   The casting to String here is similar to the problem stated in 
https://issues.apache.org/jira/browse/TINKERPOP-2932 . Essentially, strategies 
that can remove steps from the end of the traversal will cause the S, E type 
parameters to become incorrect. This could end up being confusing for users. 
I'm fine with this trade-off as long as other potential implementations have 
even worse useability.





> Allow explain() to work in a remote fashion
> -------------------------------------------
>
>                 Key: TINKERPOP-2128
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2128
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.4.0
>            Reporter: Alan Boudreault
>            Priority: Critical
>
> {{g.V().explain()}} doesn´t really work in any scenario where the traversal 
> is being executed remotely. the {{explain()}} applies locally in java so you 
> really just get this:
> {code}
> gremlin> g = traversal().withRemote('conf/remote-graph.properties')
> ==>graphtraversalsource[emptygraph[empty], standard]
> gremlin> g.V().out().explain()
> ==>Traversal Explanation
> ============================================================================================
> Original Traversal   [GraphStep(vertex,[]), VertexStep(OUT,vertex)]
> RemoteStrategy [D]   
> [RemoteStep(DriverServerConnection-localhost/127.0.0.1:8182 [graph=g])]
> Final Traversal      
> [RemoteStep(DriverServerConnection-localhost/127.0.0.1:8182 [graph=g])]
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to