You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by mi...@apache.org on 2024/01/16 22:04:03 UTC

(impala) branch master updated: IMPALA-12582: Fix crash when enabling MIN_MAX RuntimeFilter in Nested Loop Join

This is an automated email from the ASF dual-hosted git repository.

michaelsmith pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git


The following commit(s) were added to refs/heads/master by this push:
     new 12fec5194 IMPALA-12582: Fix crash when enabling MIN_MAX RuntimeFilter in Nested Loop Join
12fec5194 is described below

commit 12fec51944eeff19030f3e7ca03868f792392732
Author: Eyizoha <ey...@163.com>
AuthorDate: Fri Jan 12 17:53:29 2024 +0800

    IMPALA-12582: Fix crash when enabling MIN_MAX RuntimeFilter in Nested Loop Join
    
    This patch fixes an issue reported by IMPALA-12582, where enabling
    MIN_MAX RuntimeFilter for a specific query would cause the executor to
    crash. The direct cause of the crash was an out-of-bounds access to
    input_vals in the ScalarFnCall::InterpretEval() function, but the root
    cause was actually due to the related ScalarExprEvaluator not invoking
    the Open() function.
    
    Testing:
     - Added new E2E test case about this issue.
    
    Change-Id: Iba951796d52f109c419587c444840adbb2d44f5d
    Reviewed-on: http://gerrit.cloudera.org:8080/20891
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Reviewed-by: Csaba Ringhofer <cs...@cloudera.com>
    Tested-by: Csaba Ringhofer <cs...@cloudera.com>
---
 be/src/exec/nested-loop-join-builder.cc                    |  5 +++++
 .../overlap_min_max_filters_on_partition_columns.test      | 14 ++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/be/src/exec/nested-loop-join-builder.cc b/be/src/exec/nested-loop-join-builder.cc
index dd5cbf12d..d40ce225c 100644
--- a/be/src/exec/nested-loop-join-builder.cc
+++ b/be/src/exec/nested-loop-join-builder.cc
@@ -174,6 +174,11 @@ Status NljBuilder::Prepare(RuntimeState* state, MemTracker* parent_mem_tracker)
 
 Status NljBuilder::Open(RuntimeState* state) {
   RETURN_IF_ERROR(DataSink::Open(state));
+
+  for (const FilterContext& ctx : filter_ctxs_) {
+    RETURN_IF_ERROR(ctx.expr_eval->Open(state));
+  }
+
   AllocateRuntimeFilters();
   return Status::OK();
 }
diff --git a/testdata/workloads/functional-query/queries/QueryTest/overlap_min_max_filters_on_partition_columns.test b/testdata/workloads/functional-query/queries/QueryTest/overlap_min_max_filters_on_partition_columns.test
index 37de0e7de..9b2ed0a07 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/overlap_min_max_filters_on_partition_columns.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/overlap_min_max_filters_on_partition_columns.test
@@ -71,3 +71,17 @@ select count(*) from functional_parquet.alltypes where month <=
 aggregation(SUM, Files processed): 24
 aggregation(SUM, Files rejected): 20
 ====
+---- QUERY
+# Test case for IMPALA-12582.
+set runtime_filter_wait_time_ms=$RUNTIME_FILTER_WAIT_TIME_MS;
+set enabled_runtime_filter_types=MIN_MAX;
+create table test_runtime_filter (id int) partitioned by (dt string) stored as parquet;
+insert into table test_runtime_filter partition(dt) select 1, '20240112';
+select dt from test_runtime_filter Where dt between
+  (select cast(to_timestamp(max(dt), 'yyyyMMdd') as string) From test_runtime_filter)
+  and (select min(dt) From test_runtime_filter);
+---- RESULTS
+'20240112'
+---- TYPES
+string
+====
\ No newline at end of file