couchbaselabs / gojsonsm

Go implementation of my JSONSM algorithm.
9 stars 7 forks source link

NotEquals transformation should use NOT expression #79

Closed nelio2k closed 5 years ago

nelio2k commented 5 years ago

At the end, resolve() marks any unresolved to false.

But logically, given an expression field1 <> "value" where field1 is not present, the result will evaluate to false.

Since field1 is not present, logically, this statement should be true.

brett19 commented 5 years ago

Due to the way that bintree handles expressions. These are the specific cases where you would want to insert a translation from field != "value" into NOT (field == "value") to ensure that the expected results are valid. The NOT expression is propagated to the bintree and correctly assumed to be false, whereas an operation such as "!=" would not be able to do this.

nelio2k commented 5 years ago

In this case we should probably remove the NotEqualsExpr and NotExistsExpr expression type since it should not be used as it could cause this case.

brett19 commented 5 years ago

I think the point would be that those two expression types should be translated by the transformer.