You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Marko A. Rodriguez (JIRA)" <ji...@apache.org> on 2015/11/17 17:19:11 UTC
[jira] [Commented] (TINKERPOP3-679) Debuggable Traversal
[ https://issues.apache.org/jira/browse/TINKERPOP3-679?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15008935#comment-15008935 ]
Marko A. Rodriguez commented on TINKERPOP3-679:
-----------------------------------------------
Perhaps this is what an {{ExplainStep}} could do. I'm not too versed in what {{EXPLAIN}} does in other query languages, but I could see it as not a "real step" but a "terminal/action step" that looks like this:
{code}
g.V().outE("knows").inE().count().explain()
{code}
This would return a {{TraversalExplain}} object much like [~rjbriody]'s {{TraversalMetrics}} object. The API for {{TraversalExplain}} could be:
{code}
TraversalExplain.getStrategies() // the sorted list of strategies that were applied
TraversalExplain.getTraversal(int strategy) // the Traversal after being strategy i was applied, where getTraversal(0) is the user constructed concatenated traversal.
TraversalExplain.getTraversals() // the sorted list of traversals after each strategy was applied.
{code}
You could then do this:
{code}
gremlin> g.V().outE("knows").inE().count().explain().getTraversals()
==>[NoStrategy,[GraphStep, VertexStep[edges,OUT,knows], VertexEdgeStep[IN],GlobalCountStep]]
==>[AdjacentIncidentStrategy,[GraphStep, VertexStep[vertices,OUT,knows], GlobalCountStep]]
==>[TinkerGraphStepStepStrategy,[TinkerGraphStep, VertexStep[vertices,OUT,knows], GlobalCountStep]]
{code}
We could probably make a {{toString()}} which is basically the data in {{getTraversals}} but all pretty like {{ProfileStep}}. This seems pretty easy to do actually (a morning session to have a fully functional example).
> Debuggable Traversal
> --------------------
>
> Key: TINKERPOP3-679
> URL: https://issues.apache.org/jira/browse/TINKERPOP3-679
> Project: TinkerPop 3
> Issue Type: Improvement
> Components: process
> Affects Versions: 3.0.2-incubating
> Reporter: stephen mallette
>
> I'd like to be able to put a {{Traversal}} into "debug mode". {{TraversalStrategy}} application is a bit too mysterious, making it hard to figure out why a {{Traversal}} is failing. In a recent debug session, the problem was only sorted out after we looked at the order in which strategies were applied and even then it was a bit tricky to really understand what was happening.
> If the {{Traversal}} were in this "debug mode" it could give us insight into that strategy application process which would mean at least the following:
> * Display the order in which strategies were applied
> * For each strategy applied, display the {{toString()}} of the {{Traversal}} at that stage.
> A developer could then logically see what's in the magic and recognize that strategy 7 is ovewriting what strategy 2 is doing or that strategy 4 is executing before strategy 3 somehow.
> Not sure what the best way is to implement this. A straightforward solution with an environment variable check and println in {{applyStrategies}} seemed too "cheap" though kinda nice because very little would change and that output would come as part of the standard {{Traversal}} execution. Other (better) ways?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)