You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by he...@apache.org on 2016/10/16 06:40:41 UTC
[5/6] incubator-impala git commit: IMPALA-3348: Avoid per-slot check
vector size in KuduScanner
IMPALA-3348: Avoid per-slot check vector size in KuduScanner
Fixes a small perf issue by avoiding extra calls to check
a vector size on every slot.
Testing: Ran EE tests.
Change-Id: Ie76d33c3d00e3be6d238226d28c4100bb65aac58
Reviewed-on: http://gerrit.cloudera.org:8080/4688
Reviewed-by: Matthew Jacobs <mj...@cloudera.com>
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/ca3fd401
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/ca3fd401
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/ca3fd401
Branch: refs/heads/master
Commit: ca3fd401be827680444590fbdf7c1b723434f2c5
Parents: 7fad3e5
Author: Matthew Jacobs <mj...@cloudera.com>
Authored: Sun Jun 12 12:22:23 2016 -0700
Committer: Internal Jenkins <cl...@gerrit.cloudera.org>
Committed: Sat Oct 15 02:49:58 2016 +0000
----------------------------------------------------------------------
be/src/exec/kudu-scanner.cc | 6 ++++--
be/src/exec/kudu-scanner.h | 4 ++++
2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/ca3fd401/be/src/exec/kudu-scanner.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/kudu-scanner.cc b/be/src/exec/kudu-scanner.cc
index 11bef14..4fcb40a 100644
--- a/be/src/exec/kudu-scanner.cc
+++ b/be/src/exec/kudu-scanner.cc
@@ -59,7 +59,8 @@ KuduScanner::KuduScanner(KuduScanNode* scan_node, RuntimeState* state)
state_(state),
cur_kudu_batch_num_read_(0),
last_alive_time_micros_(0),
- tuple_num_null_bytes_(scan_node_->tuple_desc()->num_null_bytes()) {
+ tuple_num_null_bytes_(scan_node_->tuple_desc()->num_null_bytes()),
+ num_string_slots_(0) {
}
Status KuduScanner::Open() {
@@ -68,6 +69,7 @@ Status KuduScanner::Open() {
for (int i = 0; i < scan_node_->tuple_desc_->slots().size(); ++i) {
if (scan_node_->tuple_desc_->slots()[i]->type().IsStringType()) {
string_slots_.push_back(scan_node_->tuple_desc_->slots()[i]);
+ ++num_string_slots_;
}
}
return scan_node_->GetConjunctCtxs(&conjunct_ctxs_);
@@ -236,7 +238,7 @@ bool KuduScanner::IsSlotNull(Tuple* tuple, const SlotDescriptor& slot) {
}
Status KuduScanner::RelocateValuesFromKudu(Tuple* tuple, MemPool* mem_pool) {
- for (int i = 0; i < string_slots_.size(); ++i) {
+ for (int i = 0; i < num_string_slots_; ++i) {
const SlotDescriptor* slot = string_slots_[i];
// NULL handling was done in KuduRowToImpalaTuple.
if (IsSlotNull(tuple, *slot)) continue;
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/ca3fd401/be/src/exec/kudu-scanner.h
----------------------------------------------------------------------
diff --git a/be/src/exec/kudu-scanner.h b/be/src/exec/kudu-scanner.h
index b31bb73..d868b05 100644
--- a/be/src/exec/kudu-scanner.h
+++ b/be/src/exec/kudu-scanner.h
@@ -126,6 +126,10 @@ class KuduScanner {
/// List of string slots that need relocation for their auxiliary memory.
std::vector<SlotDescriptor*> string_slots_;
+
+ /// Number of string slots that need relocation (i.e. size of string_slots_), stored
+ /// separately to avoid calling vector::size() in the hot path (IMPALA-3348).
+ int num_string_slots_;
};
} /// namespace impala