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
{{ message }}
Repository navigation
SQL engine v2 pushes = NULL, <> NULL and IN lists with NULL down as conditions instead of matching no rows #3931
SQL engine v2 (sql.engine: new, and auto when it does not fall back) pushes comparisons against a NULL literal down as Resource conditions. Under SQL three-valued logic each is UNKNOWN for every row, so it should match nothing; the legacy engine returns nothing for them.
SQL
Pushed as
Rows today (v2)
SQL / legacy
b = NULL
equals with an undefined value
error or explicit-null rows, by attribute type
none
b <> NULL / b != NULL
ne branches plus the ne null guard
present non-null rows
none
b NOT IN (1, NULL)
ne 1, ne undefined, ne null
present rows other than 1
none
A NULL literal normalizes to { kind: 'literal', value: undefined } (AlaSQL's NullValue has no value), so the lowering never sees null.
sqlEngine/optimizer/whereToConditions.tsleafToCondition (binop and in cases).
Fix
Leave =/<> against NULL and an IN list containing NULL as residual, as the range case does. IS [NOT] NULL is the SQL spelling for a null test and is unaffected. Pin it with the SQL matrix in unitTests/resources/nullOmittedScanFilterParity.test.js.
Activity