Csaba Ringhofer has submitted this change and it was merged. ( 
https://gerrit.cloudera.org/25429 )

Change subject: IMPALA-15799: Fix codegen crash on struct member predicates on 
NULL tuples
......................................................................

IMPALA-15799: Fix codegen crash on struct member predicates on NULL tuples

SlotRef::Init hard-coded tuple_is_nullable_ to false for slots whose
parent is a struct-children tuple (added by IMPALA-11416 to fix an
uninitialised read). For these slots tuple_idx_ is the index of the
master tuple, which can be NULL, e.g. on the nullable side of an outer
join. Codegen trusts tuple_is_nullable_: it omitted the tuple NULL check
in CodegenNullChecking, allowed CanCodegenBranchFree (which reads the
null indicator straight from the tuple pointer), and used a codegen'd
function cache key that did not distinguish nullable tuples. A predicate
on a struct member evaluated on a row with a NULL tuple, such as an
unmatched build row of a right outer join, then dereferenced NULL and
crashed impalad. The interpreted path always checks for a NULL tuple, so
the query only crashed with codegen enabled.

Set tuple_is_nullable_ from the row descriptor for struct children too.

Add regression tests to struct-in-select-list.test with predicates on
STRING and INT struct members in right outer joins. They crash impalad
without the fix. The struct must also be in the select list, otherwise
its members are not placed in a separate struct tuple.

Testing:
- Ran test_nested_types.py (all pass), including the new queries with
  codegen enabled and disabled on parquet and orc.
- Verified manually that full outer joins with the struct on either
  side give identical results with codegen on and off.

Change-Id: If7257ddf9b883e996ff2ce625e690b922b12cbad
Assisted-by: Claude Sonnet 5.5 (Claude Code)
Reviewed-on: https://gerrit.cloudera.org/25429
Tested-by: Impala Public Jenkins <[email protected]>
Reviewed-by: Csaba Ringhofer <[email protected]>
---
M be/src/exprs/slot-ref.cc
M 
testdata/workloads/functional-query/queries/QueryTest/struct-in-select-list.test
2 files changed, 42 insertions(+), 2 deletions(-)

Approvals:
  Impala Public Jenkins: Verified
  Csaba Ringhofer: Looks good to me, approved

-- 
To view, visit https://gerrit.cloudera.org/25429
To unsubscribe, visit https://gerrit.cloudera.org/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If7257ddf9b883e996ff2ce625e690b922b12cbad
Gerrit-Change-Number: 25429
Gerrit-PatchSet: 2
Gerrit-Owner: Joe McDonnell <[email protected]>
Gerrit-Reviewer: Balazs Hevele <[email protected]>
Gerrit-Reviewer: Csaba Ringhofer <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>

Reply via email to