You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Daniel Becker (Jira)" <ji...@apache.org> on 2022/07/05 12:25:00 UTC

[jira] [Updated] (IMPALA-11410) Codegen crashes instead of reporting corrupt function

     [ https://issues.apache.org/jira/browse/IMPALA-11410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Becker updated IMPALA-11410:
-----------------------------------
    Language: C++

> 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
>            Priority: Minor
>
> 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: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org