[
https://issues.apache.org/jira/browse/TINKERPOP3-758?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Marko A. Rodriguez closed TINKERPOP3-758.
-----------------------------------------
Resolution: Fixed
Assignee: Marko A. Rodriguez
Fix Version/s: 3.0.0.GA
This has been fixed.
{code}
gremlin> g.V().match(__.as('a').out('created').as('b'),
__.as('b').in().count().is(eq(1))).select('a','b').by('name').profile().cap('~metrics')
==>Traversal Metrics
Step Count
Traversers Time (ms) % Dur
=============================================================================================================
TinkerGraphStep([],vertex) 6
6 0.360 6.49
MatchStep(AND,[[MatchStartStep(a), ProfileStep,... 1
1 2.269 40.84
MatchStartStep(a) 6
6 0.120
VertexStep(OUT,[created],vertex) 4
4 0.102
MatchEndStep(b) 4
4 0.240
MatchStartStep(b) 4
4 0.092
TraversalFlatMapStep([VertexStep(IN,edge), Pr... 1
1 1.236
VertexStep(IN,edge) 10
10 0.099
RangeGlobalStep(0,2) 7
7 0.093
CountGlobalStep 4
4 0.919
IsStep(eq(1)) 1
1 0.168
MatchEndStep 1
1 0.132
SelectStep([a, b],[value(name)]) 1
1 0.394 7.10
SideEffectCapStep([~metrics]) 1
1 2.532 45.57
>TOTAL -
- 5.556 -
gremlin>
{code}
This only effects {{MatchStep}} cause {{MatchAlgorithm}} dynamically gets the
end labels of a traversal. When {{ProfileStep}} is inserted into the mix, the
end step is not what is expected. I added a TOTAL hack to {{MatchStep}}:
{code}
public static Optional<String> getEndLabel(final Traversal.Admin<Object,
Object> traversal) {
return traversal.getEndStep() instanceof ProfileStep ? //
TOTAL HACK
((MatchEndStep)
traversal.getEndStep().getPreviousStep()).getMatchKey() :
((MatchEndStep) traversal.getEndStep()).getMatchKey();
}
{code}
This really sucks. Be nice if there was like a {{MatchEndStepProfileStep}} :|
...........or, if we could label {{ProfileStep}} and then change the
"getEndLabel()" code to just {{getLabels().iterator().next()}}.
> match() and profile() don't play well together
> ----------------------------------------------
>
> Key: TINKERPOP3-758
> URL: https://issues.apache.org/jira/browse/TINKERPOP3-758
> Project: TinkerPop 3
> Issue Type: Bug
> Components: process
> Reporter: Daniel Kuppitz
> Assignee: Marko A. Rodriguez
> Fix For: 3.0.0.GA
>
>
> {code}
> // find songs and their most common followers; keep only those songs that are
> common followers themselves
>
> gremlin>
> g.V().hasLabel("song").match(__.as("song").out("followedBy").groupCount().order(local).by(valueDecr).mapKeys().limit(1).as("mostCommonFollower")).select("song","mostCommonFollower").by("name").sideEffect(select("mostCommonFollower").aggregate("mcf")).where("song",
> within("mcf")).profile().cap(TraversalMetrics.METRICS_KEY)
> org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.ProfileStep
> cannot be cast to
> org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchStep$MatchEndStep
> Display stack trace? [yN]
> {code}
> For easier copy & pasting and better readability:
> {code}
> g.V().hasLabel("song").match(
>
> __.as("song").out("followedBy").groupCount().order(local).by(valueDecr).mapKeys().limit(1).as("mostCommonFollower")
> ).select("song","mostCommonFollower").by("name").sideEffect(
> select("mostCommonFollower").aggregate("mcf")
> ).where("song", within("mcf")).profile().cap(TraversalMetrics.METRICS_KEY)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)