Cypher: substring sometimes sets default length #369

Closed
flipside opened this Issue Dec 14, 2012 · 5 comments

Projects

None yet

4 participants

@flipside

Not sure what's going on behind the scenes, sometimes length is 7, 8 or max.

http://console.neo4j.org/r/qvw357

@jexp
Member
jexp commented Dec 14, 2012

Problem is here, it takes the literal length of the first argument, when no length is passed. As a workaround until this is fixed just pass a large value for length (like this: http://console.neo4j.org/r/vzio2s)

https://github.com/neo4j/neo4j/blob/master/community/cypher/src/main/scala/org/neo4j/cypher/internal/parser/v1_9/Expressions.scala#L158

@flipside

Yeah, the workaround is easy.

Thanks for the link, it's my first time seeing the scala functions. Doesn't look too scary, there's hope yet that I'll be able to make a useful pull request! (not for this though)

@freeeve
Contributor
freeeve commented Dec 14, 2012

So apparently I didn't put any unit tests in for substring of 1 argument. O.o Woops.

@freeeve
Contributor
freeeve commented Dec 14, 2012

Now I have one...
Failed tests: substring_with_default_length(org.neo4j.cypher.ExecutionEngineTest): List(Map(s -> 1234567)) did not equal List(Map(s -> 123456789))

I'll submit a pull request in a bit.

@flipside

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment