You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by st...@apache.org on 2023/02/28 23:53:53 UTC

[impala] branch master updated: IMPALA-11803: Fix hitting DCHECK when running union on empty table with MT_DOP>1

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

stigahuang 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 fd3bccf5f IMPALA-11803: Fix hitting DCHECK when running union on empty table with MT_DOP>1
fd3bccf5f is described below

commit fd3bccf5f4b30bc3bd754dc11f41f6629047f5b1
Author: Joe McDonnell <jo...@cloudera.com>
AuthorDate: Wed Nov 23 16:40:42 2022 -0800

    IMPALA-11803: Fix hitting DCHECK when running union on empty table with MT_DOP>1
    
    The DCHECK was caused as the value of useMtScanNode_
    was not getting set for empty tables. This was because of
    a condition for empty tables that returned from the
    computeNodeResourceProfile() function before setting up
    useMtScanNode_. It got rectified by placing the
    assignment of useMtScanNode_ before that condition.
    
    Testing: The fix is verified with an end-to-end test in test_mt_dop.py.
    
    Change-Id: Idbae5e1a78211327a214b2d936743bda767ae3c4
    Reviewed-on: http://gerrit.cloudera.org:8080/19474
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java | 3 ++-
 tests/custom_cluster/test_mt_dop.py                          | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java b/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java
index bb61b4dda..9931d5849 100644
--- a/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java
+++ b/fe/src/main/java/org/apache/impala/planner/HdfsScanNode.java
@@ -2110,6 +2110,8 @@ public class HdfsScanNode extends ScanNode {
 
   @Override
   public void computeNodeResourceProfile(TQueryOptions queryOptions) {
+    // Update 'useMtScanNode_' before any return cases. It's used in BE.
+    useMtScanNode_ = queryOptions.mt_dop > 0;
     Preconditions.checkNotNull(scanRangeSpecs_, "Cost estimation requires scan ranges.");
     long scanRangeSize =
         scanRangeSpecs_.getConcrete_rangesSize() + generatedScanRangeCount_;
@@ -2149,7 +2151,6 @@ public class HdfsScanNode extends ScanNode {
     }
 
     // The non-MT scan node requires at least one scanner thread.
-    useMtScanNode_ = queryOptions.mt_dop > 0;
     int requiredThreads = useMtScanNode_ ? 0 : 1;
     int maxScannerThreads = computeMaxNumberOfScannerThreads(queryOptions,
         perHostScanRanges);
diff --git a/tests/custom_cluster/test_mt_dop.py b/tests/custom_cluster/test_mt_dop.py
index 098df2872..e832a26f2 100644
--- a/tests/custom_cluster/test_mt_dop.py
+++ b/tests/custom_cluster/test_mt_dop.py
@@ -65,6 +65,15 @@ class TestMtDopFlags(CustomClusterTestSuite):
     self.run_test_case('QueryTest/runtime_filters_mt_dop', vector,
         test_file_vars={'$RUNTIME_FILTER_WAIT_TIME_MS': str(WAIT_TIME_MS)})
 
+  @CustomClusterTestSuite.with_args(cluster_size=1)
+  def test_mt_dop_union_empty_table(self, unique_database):
+    """ Regression test for IMPALA-11803: When used in DEBUG build,
+    impalad crashed while running union on an empty table with MT_DOP>1.
+    This test verifies the fix on the same."""
+    self.client.execute("set mt_dop=2")
+    self.client.execute("select count(*) from (select f2 from"
+                        " functional.emptytable union all select id from"
+                        " functional.alltypestiny) t")
 
 class TestMaxMtDop(CustomClusterTestSuite):
   @classmethod