stephen mallette created TINKERPOP-1859:
-------------------------------------------

             Summary: Complex instance of P not serializing to bytecode properly
                 Key: TINKERPOP-1859
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1859
             Project: TinkerPop
          Issue Type: Bug
          Components: python
    Affects Versions: 3.2.7
            Reporter: stephen mallette


Not sure what's happening but this traversal does not return any results with 
gremlin-python:

{code}
gremlin> g.V().hasLabel("person").has("age", 
P.not(P.lte(10).and(P.not(P.between(11, 
20)))).and(P.lt(29).or(P.eq(35)))).values("name")
==>vadas
==>peter
{code}

When looking at the bytecode the python bytecode is different from the java 
bytecode. The java bytecode for the predicate is:

{code}
{
        "@type": "g:P",
        "@value": {
                "predicate": "and",
                "value": [{
                        "@type": "g:P",
                        "@value": {
                                "predicate": "or",
                                "value": [{
                                        "@type": "g:P",
                                        "@value": {
                                                "predicate": "gt",
                                                "value": {
                                                        "@type": "g:Int32",
                                                        "@value": 10
                                                }
                                        }
                                }, {
                                        "@type": "g:P",
                                        "@value": {
                                                "predicate": "and",
                                                "value": [{
                                                        "@type": "g:P",
                                                        "@value": {
                                                                "predicate": 
"gte",
                                                                "value": {
                                                                        
"@type": "g:Int32",
                                                                        
"@value": 11
                                                                }
                                                        }
                                                }, {
                                                        "@type": "g:P",
                                                        "@value": {
                                                                "predicate": 
"lt",
                                                                "value": {
                                                                        
"@type": "g:Int32",
                                                                        
"@value": 20
                                                                }
                                                        }
                                                }]
                                        }
                                }]
                        }
                }, {
                        "@type": "g:P",
                        "@value": {
                                "predicate": "or",
                                "value": [{
                                        "@type": "g:P",
                                        "@value": {
                                                "predicate": "lt",
                                                "value": {
                                                        "@type": "g:Int32",
                                                        "@value": 29
                                                }
                                        }
                                }, {
                                        "@type": "g:P",
                                        "@value": {
                                                "predicate": "eq",
                                                "value": {
                                                        "@type": "g:Int32",
                                                        "@value": 35
                                                }
                                        }
                                }]
                        }
                }]
        }
}
{code}

The python bytecode is:

{code}
{
        "@type": "g:P",
        "@value": {
                "predicate": "and",
                "value": [{
                        "@type": "g:P",
                        "@value": {
                                "predicate": "not",
                                "value": {
                                        "@type": "g:P",
                                        "@value": {
                                                "predicate": "and",
                                                "value": [{
                                                        "@type": "g:P",
                                                        "@value": {
                                                                "predicate": 
"lte",
                                                                "value": {
                                                                        
"@type": "g:Int64",
                                                                        
"@value": 10
                                                                }
                                                        }
                                                }, {
                                                        "@type": "g:P",
                                                        "@value": {
                                                                "predicate": 
"not",
                                                                "value": {
                                                                        
"@type": "g:P",
                                                                        
"@value": {
                                                                                
"predicate": "between",
                                                                                
"value": [{
                                                                                
        "@type": "g:Int64",
                                                                                
        "@value": 11
                                                                                
}, {
                                                                                
        "@type": "g:Int64",
                                                                                
        "@value": 20
                                                                                
}]
                                                                        }
                                                                }
                                                        }
                                                }]
                                        }
                                }
                        }
                }, {
                        "@type": "g:P",
                        "@value": {
                                "predicate": "or",
                                "value": [{
                                        "@type": "g:P",
                                        "@value": {
                                                "predicate": "lt",
                                                "value": {
                                                        "@type": "g:Int64",
                                                        "@value": 29
                                                }
                                        }
                                }, {
                                        "@type": "g:P",
                                        "@value": {
                                                "predicate": "eq",
                                                "value": {
                                                        "@type": "g:Int64",
                                                        "@value": 35
                                                }
                                        }
                                }]
                        }
                }]
        }
}
{code}

This fix should likely be applied as part of TINKERPOP-1857 (or after it is 
merged) as there were a few modifications in that branch around {{P}} to 
resolve other issues.




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to