You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT NULLIF(NULL,'') IS NULL AS a, NULLIF(NULL,'') IS NOT NULL AS b FROM <<{'a': 1}>>
[-1:-1:<unknown>: Expression always returns null or missing., -1:-1:<unknown>: Expression always returns null or missing.]
java.lang.AssertionError: [-1:-1:<unknown>: Expression always returns null or missing., -1:-1:<unknown>: Expression always returns null or missing.]
at org.partiql.lang.planner.transforms.PartiQLSchemaInferencerTests.runTest(PartiQLSchemaInferencerTests.kt:2831)
at org.partiql.lang.planner.transforms.PartiQLSchemaInferencerTests.runTest(PartiQLSchemaInferencerTests.kt:2792)
at org.partiql.lang.planner.transforms.PartiQLSchemaInferencerTests.test(PartiQLSchemaInferencerTests.kt:141)
at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
.....
Expected Behavior
This is not an erroneous query and we should not fail here.
Additional Context
Java version:.
PartiQL version: 0.13.2
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
We were actually just discussing this a few days ago. Since NULLIF essentially uses EQ internally to check equality of the operands, we can look at the PartiQL Specification for guidance:
Equality never fails in the type-checking mode and never returns MISSING in the permissive mode. Instead, it can
compare values of any two types, according to the rules of the PartiQL type system.
If the error is being thrown due to the comparison of NULL and '', then I believe we're being too haste in throwing an error. Should be an INFO message -- not a WARNING or ERROR. Therefore, the issue is valid. In the first projection (NULLIF(NULL,'')), it really has the logic of:
CASE WHEN NULL = '' THEN NULL ELSE NULL END
If it is due to NULLIF always returning NULL, then we can look further into PartiQL's specification:
In a more important and common case, an PartiQL implementation can
utilize the input data schema to prove that a path expression always returns MISSING and thus throw a compile-time
error.
While this specifically gives the example of "path expression", the PartiQL team has interpreted this excerpt to say:
In a more important and common case, a PartiQL implementation can
utilize the input data schema to prove that an expression always returns MISSING and thus throw a compile-time error.
That being said, this only relates to MISSING and, seemingly, not NULL.
So, yeah, I believe this is a bug. Needs more research into where exactly it's being thrown.
Description
To Reproduce
Expected Behavior
This is not an erroneous query and we should not fail here.
Additional Context
The text was updated successfully, but these errors were encountered: