You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2020/04/23 05:50:01 UTC

[kudu] branch master updated: client: fix extra construction of ColumnSchema

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9c5d8c9  client: fix extra construction of ColumnSchema
9c5d8c9 is described below

commit 9c5d8c97915376de4fb6027a3f73d00e160fd1d7
Author: Todd Lipcon <to...@apache.org>
AuthorDate: Wed Apr 22 22:00:07 2020 -0700

    client: fix extra construction of ColumnSchema
    
    The VARCHAR patches introduced a line 'auto col = schema.column(idx)'
    which ends up making a copy of the ColumnSchema object instead of taking
    a reference to it. This is unnecessary and quite slow. This shows up as
    a significant CPU consumer when running tpch_real_world insert workload.
    
    Change-Id: Iafae805979495e7e15c5294a317d6e00255654e0
    Reviewed-on: http://gerrit.cloudera.org:8080/15787
    Reviewed-by: Andrew Wong <aw...@cloudera.com>
    Tested-by: Kudu Jenkins
---
 src/kudu/common/partial_row.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/kudu/common/partial_row.cc b/src/kudu/common/partial_row.cc
index 5a10476..8b3096a 100644
--- a/src/kudu/common/partial_row.cc
+++ b/src/kudu/common/partial_row.cc
@@ -415,7 +415,7 @@ Status KuduPartialRow::SetVarcharNoCopyUnsafe(const Slice& col_name, const Slice
 }
 
 Status KuduPartialRow::SetVarcharNoCopyUnsafe(int col_idx, const Slice& val) {
-  auto col = schema_->column(col_idx);
+  const auto& col = schema_->column(col_idx);
   if (val.size() > col.type_attributes().length * 4) {
     return Status::InvalidArgument(
         Substitute("Value too long, limit is $0 characters",
@@ -433,7 +433,7 @@ Status KuduPartialRow::SetSliceCopy(const Slice& col_name, const Slice& val) {
 
 template<typename T>
 Status KuduPartialRow::SetSliceCopy(int col_idx, const Slice& val) {
-  auto col = schema_->column(col_idx);
+  const auto& col = schema_->column(col_idx);
   Slice relocated_val;
   switch (T::type) {
     case VARCHAR: