Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparison error in roots #6

Closed
junknown opened this issue Dec 5, 2018 · 4 comments
Closed

Comparison error in roots #6

junknown opened this issue Dec 5, 2018 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@junknown
Copy link
Contributor

junknown commented Dec 5, 2018

Roots elements in predicates of types 'comparison' ( like where a.prop>2) shows only the first argument ( a.prop).

To replicate try to parse

MATCH (n)--(friend)
    WHERE n.age > 3
    RETURN n

it reports as roots:

[ { type: 'statement',
body:
{ type: 'query',
clauses:
[ { type: 'match',
optional: false,
pattern:
{ type: 'pattern',
paths:
[ { type: 'pattern-path',
elements:
[ { type: 'node-pattern',
identifier: { type: 'identifier', name: 'n' },
labels: [] },
{ type: 'rel-pattern', direction: 2, reltypes: [] },
{ type: 'node-pattern',
identifier: { type: 'identifier', name: 'friend' },
labels: [] } ] } ] },
hints: [],
predicate:
{ type: 'comparison',
length: 1,
ops: [ 'greater-than' ],
args:
[ { type: 'property-operator',
expression: { type: 'identifier', name: 'n' },
propName: { type: 'prop-name', value: 'age' } } ] }
},
{ type: 'return',
distinct: false,
includeExisting: false,
projections:
[ { type: 'projection',
expression: { type: 'identifier', name: 'n' } } ] } ],
options: [] },
options: [] } ]

@Loupi
Copy link
Owner

Loupi commented Dec 6, 2018

Thank you for the detailed info, it allowed me to spot the error quickly.

In parser.cpp, line 920 looks like:
LoopNodes("args", cypher_ast_comparison_get_length(node), cypher_ast_comparison_get_argument);
In fact, it should be:
LoopNodes("args", cypher_ast_comparison_get_length(node) + 1, cypher_ast_comparison_get_argument);

A fix is coming.

@Loupi Loupi self-assigned this Dec 6, 2018
@Loupi Loupi added the bug Something isn't working label Dec 6, 2018
@Loupi
Copy link
Owner

Loupi commented Dec 6, 2018

#7

@Loupi
Copy link
Owner

Loupi commented Dec 6, 2018

@Loupi Loupi closed this as completed Dec 6, 2018
@junknown
Copy link
Contributor Author

junknown commented Dec 6, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants