Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-1859

Complex instance of P not serializing to bytecode properly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.7
    • Fix Version/s: 3.2.8, 3.3.2
    • Component/s: python
    • Labels:
      None

      Description

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

      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
      

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

      {
      	"@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
      						}
      					}
      				}]
      			}
      		}]
      	}
      }
      

      The python bytecode is:

      {
      	"@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
      						}
      					}
      				}]
      			}
      		}]
      	}
      }
      

      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.

        Attachments

          Activity

            People

            • Assignee:
              spmallette Stephen Mallette
              Reporter:
              spmallette Stephen Mallette
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: