IMPALA-6099: Fix crash in CheckForAlwaysFalse()

Filter states indexed by FilterStats::ROW_GROUPS_KEY was only relevant
if the runtime filter is bound by partitioning columns. This is no
longer true since always-false filter can filter out row groups as
well, which results in a crash in CheckForAlwaysFalse(). This patch
registers row groups counters unconditionally to fix this bug.

Change-Id: I3eda43845b78516c1e76e07e0d2dd9d862168e1d
Reviewed-on: http://gerrit.cloudera.org:8080/8369
Reviewed-by: Tim Armstrong <[email protected]>
Tested-by: Impala Public Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/2bd01078
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/2bd01078
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/2bd01078

Branch: refs/heads/master
Commit: 2bd010781c07fee9dc09924856ac7ced11e6be3e
Parents: c87ad36
Author: Tianyi Wang <[email protected]>
Authored: Mon Oct 23 13:38:42 2017 -0700
Committer: Impala Public Jenkins <[email protected]>
Committed: Tue Oct 24 22:19:22 2017 +0000

----------------------------------------------------------------------
 be/src/exec/filter-context.cc | 4 ++--
 be/src/exec/filter-context.h  | 2 +-
 be/src/exec/scan-node.cc      | 4 +---
 3 files changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/2bd01078/be/src/exec/filter-context.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/filter-context.cc b/be/src/exec/filter-context.cc
index 61e104f..2a07c6f 100644
--- a/be/src/exec/filter-context.cc
+++ b/be/src/exec/filter-context.cc
@@ -33,14 +33,14 @@ const std::string FilterStats::ROWS_KEY = "Rows";
 
 const char* FilterContext::LLVM_CLASS_NAME = "struct.impala::FilterContext";
 
-FilterStats::FilterStats(RuntimeProfile* runtime_profile, bool 
is_partition_filter) {
+FilterStats::FilterStats(RuntimeProfile* runtime_profile) {
   DCHECK(runtime_profile != nullptr);
   profile = runtime_profile;
   RegisterCounterGroup(FilterStats::SPLITS_KEY);
   RegisterCounterGroup(FilterStats::FILES_KEY);
   // TODO: These only apply to Parquet, so only register them in that case.
   RegisterCounterGroup(FilterStats::ROWS_KEY);
-  if (is_partition_filter) RegisterCounterGroup(FilterStats::ROW_GROUPS_KEY);
+  RegisterCounterGroup(FilterStats::ROW_GROUPS_KEY);
 }
 
 void FilterStats::IncrCounters(const string& key, int32_t total, int32_t 
processed,

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/2bd01078/be/src/exec/filter-context.h
----------------------------------------------------------------------
diff --git a/be/src/exec/filter-context.h b/be/src/exec/filter-context.h
index dcd2a94..0806fd3 100644
--- a/be/src/exec/filter-context.h
+++ b/be/src/exec/filter-context.h
@@ -41,7 +41,7 @@ class FilterStats {
   /// Constructs a new FilterStats object with a profile that is a child of
   /// 'profile'. 'is_partition_filter' determines whether partition-level 
counters are
   /// registered.
-  FilterStats(RuntimeProfile* runtime_profile, bool is_partition_filter);
+  FilterStats(RuntimeProfile* runtime_profile);
 
   static const std::string ROW_GROUPS_KEY;
   static const std::string FILES_KEY;

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/2bd01078/be/src/exec/scan-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/scan-node.cc b/be/src/exec/scan-node.cc
index eba7727..fd2453d 100644
--- a/be/src/exec/scan-node.cc
+++ b/be/src/exec/scan-node.cc
@@ -57,7 +57,6 @@ const string ScanNode::NUM_SCANNER_THREADS_STARTED =
 
 Status ScanNode::Init(const TPlanNode& tnode, RuntimeState* state) {
   RETURN_IF_ERROR(ExecNode::Init(tnode, state));
-
   const TQueryOptions& query_options = state->query_options();
   for (const TRuntimeFilterDesc& filter_desc : tnode.runtime_filters) {
     auto it = filter_desc.planid_to_target_ndx.find(tnode.node_id);
@@ -85,8 +84,7 @@ Status ScanNode::Init(const TPlanNode& tnode, RuntimeState* 
state) {
     RuntimeProfile* profile =
         RuntimeProfile::Create(state->obj_pool(), filter_profile_title);
     runtime_profile_->AddChild(profile);
-    filter_ctx.stats = state->obj_pool()->Add(new FilterStats(profile,
-        target.is_bound_by_partition_columns));
+    filter_ctx.stats = state->obj_pool()->Add(new FilterStats(profile));
   }
 
   return Status::OK();

Reply via email to