[ 
https://issues.apache.org/jira/browse/TINKERPOP-2856?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kelvin Lawrence updated TINKERPOP-2856:
---------------------------------------
    Description: 
As reported on 
[StackOverflow|https://stackoverflow.com/questions/74121856/gremlin-reserved-word-exp]
 if a variable used as part of the math() step contains a reserved word such as 
"exp" the evaluation of the expression fails. For example

 
{code:java}
math('number1-expected_value').next(){code}
results in
{code:java}
*GremlinServerError: 499: {"detailedMessage":"Unknown function or variable 
'cted_value' at pos 20 in expression 'number1 - 
expected_value'","requestId":"01e3f9e6-3cf2-4af0-bf94-5a4979d488b4","code":"InvalidParameterException"}*{code}
{{{}I am able to reproduce this in the Gremlin Console using TinkerPop version 
3.6.0 using:{}}}{{{{}}{}}}
{code:java}
gremlin> g.inject(1).as('expa').constant(2).as('c').math('c - expa')
Unknown function or variable 'a' at pos 7 in expression 'c - expa'
Type ':help' or ':h' for help.
Display stack trace? [yN]

gremlin> g.inject(1).as('a').constant(2).as('c').math('c - a')
==>1.0  {code}

  was:
As reported on 
[StackOverflow|https://stackoverflow.com/questions/74121856/gremlin-reserved-word-exp]
 if a variable used as part of the math() step contains a reserved word such as 
"exp" the evaluation of the expression fails. For example

{{}}
{code:java}
math('number1-expected_value').next(){code}
{{}}

results in

{{}}

{{}}
{code:java}

{code}
{{**GremlinServerError: 499: \{"detailedMessage":"Unknown function or variable 
'cted_value' at pos 20 in expression 'number1 - 
expected_value'","requestId":"01e3f9e6-3cf2-4af0-bf94-5a4979d488b4","code":"InvalidParameterException"}**}}

{{{}I am able to reproduce this in the Gremlin Console using TinkerPop version 
3.6.0 using:{}}}{{{}{}}}
{code:java}
gremlin> g.inject(1).as('expa').constant(2).as('c').math('c - expa')
Unknown function or variable 'a' at pos 7 in expression 'c - expa'
Type ':help' or ':h' for help.
Display stack trace? [yN]

gremlin> g.inject(1).as('a').constant(2).as('c').math('c - a')
==>1.0  {code}
{{}}

{{}}

 

{{}}


> math() step fails if variable name contains a keyword
> -----------------------------------------------------
>
>                 Key: TINKERPOP-2856
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2856
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>         Environment: Any Gremlin version that has the math() step. Reproduced 
> on 3.6.0
>            Reporter: Kelvin Lawrence
>            Priority: Major
>
> As reported on 
> [StackOverflow|https://stackoverflow.com/questions/74121856/gremlin-reserved-word-exp]
>  if a variable used as part of the math() step contains a reserved word such 
> as "exp" the evaluation of the expression fails. For example
>  
> {code:java}
> math('number1-expected_value').next(){code}
> results in
> {code:java}
> *GremlinServerError: 499: {"detailedMessage":"Unknown function or variable 
> 'cted_value' at pos 20 in expression 'number1 - 
> expected_value'","requestId":"01e3f9e6-3cf2-4af0-bf94-5a4979d488b4","code":"InvalidParameterException"}*{code}
> {{{}I am able to reproduce this in the Gremlin Console using TinkerPop 
> version 3.6.0 using:{}}}{{{{}}{}}}
> {code:java}
> gremlin> g.inject(1).as('expa').constant(2).as('c').math('c - expa')
> Unknown function or variable 'a' at pos 7 in expression 'c - expa'
> Type ':help' or ':h' for help.
> Display stack trace? [yN]
> gremlin> g.inject(1).as('a').constant(2).as('c').math('c - a')
> ==>1.0  {code}



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

Reply via email to