Andrew Kyle Purtell created PHOENIX-8055:
--------------------------------------------
Summary: An uncovered index scan drops rows after a row with NULL
conditions
Key: PHOENIX-8055
URL: https://issues.apache.org/jira/browse/PHOENIX-8055
Project: Phoenix
Issue Type: Bug
Affects Versions: 5.3.2
Reporter: Andrew Kyle Purtell
Assignee: Andrew Kyle Purtell
Fix For: 5.4.0, 5.3.3
During uncovered global index scans, post-scan filtering evaluates unindexed
predicate conditions against merged data rows directly on the server.
{{RegionScannerFactory}} evaluates predicates across merged rows without
resetting the underlying expression tree between row iterations, causing these
queries to omit matching rows whenever an earlier record encounters {{NULL}}
values.
Under the hood, composite logical operators inherit a persistent {{seenNull}}
flag via {{{}AndOrExpression{}}}. When a row encounters a {{NULL}} evaluation
within any branch of a conjunction, this flag remains latched for subsequent
evaluations. When a later row satisfies all conditions, the lingering flag
forces the compound {{AND}} expression to evaluate to {{NULL}} rather than
{{{}TRUE{}}}. The scanner treats this as a failed match and discards the
record, dropping all remaining qualifying rows within that region scan or salt
bucket. Conjunctions are uniquely susceptible to this leakage. Disjunctions
naturally short-circuit upon encountering a {{TRUE}} condition before the
corrupted flag can alter the outcome.
The fix introduces an expression {{reset()}} prior to evaluating each row
within {{{}RegionScannerFactory{}}}, aligning its evaluation lifecycle with the
standard behavior implemented in {{{}BooleanExpressionFilter{}}}. This
lifecycle reset prevents cross-row state pollution, ensuring consistent
predicate evaluation across both salted and unsalted uncovered index execution
plans.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)