Daniel Becker created IMPALA-11410:
--------------------------------------
Summary: Codegen crashes instead of reporting corrupt function
Key: IMPALA-11410
URL: https://issues.apache.org/jira/browse/IMPALA-11410
Project: IMPALA
Issue Type: Bug
Components: Backend
Reporter: Daniel Becker
In {{FragmentState::CodegenHelper}} we call {{plan_tree_->Codegen(this)}} and
{{sink_config_->Codegen(this)}} but the status of codegenning is discarded (or
only used in the profile). If codegen fails because of a bug and the generated
functions fail verification, {{LlvmCodeGen::is_corrupt_}} is set to true, which
means all further functions will fail verification too. This can lead to
{{LlvmCodeGen::GetHashFunction}} returning {{{}NULL{}}}, but in
{{HashTableCtx::CodegenHashRow}} we dereference this {{NULL}} pointer, causing
a crash. See
[https://github.com/apache/impala/blob/bb610dee09a8069bb993b4c668f7e481c1774b70/be/src/exec/hash-table.cc#L1043
(the
pointer|https://github.com/apache/impala/blob/bb610dee09a8069bb993b4c668f7e481c1774b70/be/src/exec/hash-table.cc#L1043]
(the pointer in question is {{{}hash_fn{}}}).
This situation only arises if there is already a bug in code generation, but if
the codegen bug is in a {{{}ScalarExpr{}}}, for example {{{}SlotRef{}}}, we
return an error message instead of crashing. See
{{FragmentState::CodegenHelper}} for how these cases are handled differently.
It would help debugging if we handled these cases uniformly, by returning an
error message.
Steps to reproduce:
1. Introduce an error in {{FilterContext::CodegenEval}} by deleting a
{{CreateBr}} call
2. Run the following query:
{code:sql}
select a.outer_struct.inner_struct2.i, b.small_struct.i
from functional_orc_def.complextypes_nested_structs a
inner join functional_orc_def.complextypes_structs b
on b.small_struct.i = a.outer_struct.inner_struct2.i + 19091
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]