Joe McDonnell created IMPALA-15799:
--------------------------------------
Summary: Codegen crashes (SIGSEGV) on struct member predicates
evaluated on the NULL side of an outer join
Key: IMPALA-15799
URL: https://issues.apache.org/jira/browse/IMPALA-15799
Project: IMPALA
Issue Type: Bug
Components: Backend
Affects Versions: Impala 5.1.0
Reporter: Joe McDonnell
With codegen enabled, a predicate on a struct member crashes impalad when the
tuple holding the struct is NULL, for example the unmatched-build output of a
right outer join. With disable_codegen=true the same query returns correct
results.
Repro using regular tables from the dev environment:
{noformat}
SELECT b.id, p.small_struct
FROM complextypes_structs p
RIGHT OUTER JOIN complextypes_structs b ON p.id + 100 = b.id
WHERE b.id = 2 OR p.small_struct.s LIKE '%abc%';{noformat}
An integer member (p.small_struct.i > 0) crashes the same way.
{noformat}
Crash: SIGSEGV / SEGV_MAPERR at NULL plus a small offset (0x24 for the string
member, 0x14 for the integer member). Stack:
<JIT conjunct>
ScalarExprEvaluator::GetBooleanVal
ExecNode::EvalConjuncts
PartitionedHashJoinNode::OutputUnmatchedBuildFromHashTable
PartitionedHashJoinNode::OutputUnmatchedBuild{noformat}
Root cause: SlotRef::Init (be/src/exprs/slot-ref.cc) hard-codes
tuple_is_nullable_ = false for slots whose parent is a struct-children tuple
(isTupleOfStructSlot()). That line came from IMPALA-11416, which fixed an
uninitialized read. For struct children tuple_idx_ has already been remapped to
the master tuple, and that tuple can be NULL, for example on the nullable side
of an outer join.
Codegen trusts the tuple_is_nullable_ value, so it omits the null check. The
interpreted path always does the null check, so disable_codegen=true is a
workaround for this issue.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)