IMPALA-3462: Fix exec option text for old HJ w/ runtime filters

Change-Id: I737e261ce251b05dd89bce939ad5df8d95d39b61
Reviewed-on: http://gerrit.cloudera.org:8080/2933
Reviewed-by: Henry Robinson <[email protected]>
Reviewed-by: Dan Hecht <[email protected]>
Tested-by: Internal 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/f6fcee9a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/f6fcee9a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/f6fcee9a

Branch: refs/heads/master
Commit: f6fcee9a7a3ab28bcc95946973343ee6bac45931
Parents: e32720e
Author: Henry Robinson <[email protected]>
Authored: Mon May 2 17:52:21 2016 -0700
Committer: Tim Armstrong <[email protected]>
Committed: Thu May 12 14:17:51 2016 -0700

----------------------------------------------------------------------
 be/src/exec/hash-join-node.cc | 16 +++++++++++++++-
 be/src/exec/old-hash-table.cc |  6 +++++-
 be/src/exec/old-hash-table.h  |  5 +++--
 3 files changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f6fcee9a/be/src/exec/hash-join-node.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hash-join-node.cc b/be/src/exec/hash-join-node.cc
index 5bc2357..0e61689 100644
--- a/be/src/exec/hash-join-node.cc
+++ b/be/src/exec/hash-join-node.cc
@@ -21,6 +21,7 @@
 #include "codegen/llvm-codegen.h"
 #include "exec/old-hash-table.inline.h"
 #include "exprs/expr.h"
+#include "gutil/strings/substitute.h"
 #include "runtime/row-batch.h"
 #include "runtime/runtime-state.h"
 #include "util/debug-util.h"
@@ -36,6 +37,7 @@ DEFINE_bool(enable_probe_side_filtering, true, "Deprecated.");
 
 using namespace impala;
 using namespace llvm;
+using namespace strings;
 
 const char* HashJoinNode::LLVM_CLASS_NAME = "class.impala::HashJoinNode";
 
@@ -227,7 +229,19 @@ Status HashJoinNode::ConstructBuildSide(RuntimeState* 
state) {
     if (eos) break;
   }
 
-  hash_tbl_->AddBloomFilters();
+  if (filters_.size() > 0) {
+    int num_enabled_filters = hash_tbl_->AddBloomFilters();
+    if (num_enabled_filters == filters_.size()) {
+      AddRuntimeExecOption(Substitute("$0 of $0 Runtime Filter$1 Published",
+              filters_.size(), filters_.size() == 1 ? "" : "s"));
+    } else {
+      string exec_option = Substitute("$0 of $1 Runtime Filter$2 Published, $3 
Disabled",
+          num_enabled_filters, filters_.size(), filters_.size() == 1 ? "" : 
"s",
+          filters_.size() - num_enabled_filters);
+      AddRuntimeExecOption(exec_option);
+    }
+  }
+
   return Status::OK();
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f6fcee9a/be/src/exec/old-hash-table.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/old-hash-table.cc b/be/src/exec/old-hash-table.cc
index 7d0653d..4d419d2 100644
--- a/be/src/exec/old-hash-table.cc
+++ b/be/src/exec/old-hash-table.cc
@@ -136,7 +136,8 @@ bool OldHashTable::EvalRow(
   return has_null;
 }
 
-void OldHashTable::AddBloomFilters() {
+int OldHashTable::AddBloomFilters() {
+  int num_enabled_filters = 0;
   vector<BloomFilter*> bloom_filters;
   bloom_filters.resize(filters_.size());
   for (int i = 0; i < filters_.size(); ++i) {
@@ -145,6 +146,7 @@ void OldHashTable::AddBloomFilters() {
     } else {
       bloom_filters[i] =
           state_->filter_bank()->AllocateScratchBloomFilter(filters_[i]->id());
+      ++num_enabled_filters;
     }
   }
 
@@ -166,6 +168,8 @@ void OldHashTable::AddBloomFilters() {
   for (int i = 0; i < filters_.size(); ++i) {
     state_->filter_bank()->UpdateFilterFromLocal(filters_[i]->id(), 
bloom_filters[i]);
   }
+
+  return num_enabled_filters;
 }
 
 // Helper function to store a value into the results buffer if the expr

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f6fcee9a/be/src/exec/old-hash-table.h
----------------------------------------------------------------------
diff --git a/be/src/exec/old-hash-table.h b/be/src/exec/old-hash-table.h
index 44d8782..0645b8d 100644
--- a/be/src/exec/old-hash-table.h
+++ b/be/src/exec/old-hash-table.h
@@ -211,8 +211,9 @@ class OldHashTable {
   }
 
   /// Can be called after all insert calls to generate runtime filters, which 
are then
-  /// published to the local runtime state's RuntimeFilterBank.
-  void AddBloomFilters();
+  /// published to the local runtime state's RuntimeFilterBank. Returns the 
number of
+  /// filters that are enabled.
+  int AddBloomFilters();
 
   /// Returns an iterator at the beginning of the hash table.  Advancing this 
iterator
   /// will traverse all elements.

Reply via email to