You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by gr...@apache.org on 2019/02/12 22:34:40 UTC

[kudu] branch master updated (626938e -> 714a680)

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

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


    from 626938e  KUDU-2411: Exclude libz from binary jar on macOS
     new 5f3470a  [rebalancer] fix LOG() misprint in rebalancer
     new 714a680  [client] Fix GetUnscaledDecimal backward compatiblity

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/kudu/common/partial_row-test.cc | 15 ++++++++++++++-
 src/kudu/common/partial_row.cc      |  8 ++++++++
 src/kudu/common/partial_row.h       |  4 ++++
 src/kudu/tools/rebalancer.cc        |  2 +-
 4 files changed, 27 insertions(+), 2 deletions(-)


[kudu] 02/02: [client] Fix GetUnscaledDecimal backward compatiblity

Posted by gr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 714a680ad73afc06fb64fc2966c176d8608b5068
Author: Grant Henke <gr...@apache.org>
AuthorDate: Mon Feb 11 15:54:37 2019 -0600

    [client] Fix GetUnscaledDecimal backward compatiblity
    
    We added the const version of GetUnscaledDecimal to
    the KuduPartialRow. However, that change was not
    backward compatible. This patch adds back the
    non-const version of the function and tests to
    ensure calling both is successful.
    
    Change-Id: I1bce3f6df6a09327a503f2793ed1317e147349c9
    Reviewed-on: http://gerrit.cloudera.org:8080/12446
    Reviewed-by: Adar Dembo <ad...@cloudera.com>
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
    Tested-by: Kudu Jenkins
---
 src/kudu/common/partial_row-test.cc | 15 ++++++++++++++-
 src/kudu/common/partial_row.cc      |  8 ++++++++
 src/kudu/common/partial_row.h       |  4 ++++
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/kudu/common/partial_row-test.cc b/src/kudu/common/partial_row-test.cc
index 5421f1d..383a090 100644
--- a/src/kudu/common/partial_row-test.cc
+++ b/src/kudu/common/partial_row-test.cc
@@ -15,6 +15,8 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include "kudu/common/partial_row.h"
+
 #include <cstdint>
 #include <functional>
 #include <string>
@@ -22,8 +24,8 @@
 #include <gtest/gtest.h>
 
 #include "kudu/common/common.pb.h"
-#include "kudu/common/partial_row.h"
 #include "kudu/common/schema.h"
+#include "kudu/util/int128.h"
 #include "kudu/util/slice.h"
 #include "kudu/util/status.h"
 #include "kudu/util/test_macros.h"
@@ -214,6 +216,17 @@ TEST_F(PartialRowTest, UnitTest) {
   EXPECT_TRUE(row.IsColumnSet(4));
   EXPECT_EQ("decimal decimal_val=123456_D32", row.ToString());
 
+  // Get a decimal value using the const version of the function.
+  int128_t decValFromConst;
+  EXPECT_OK(const_cast<const KuduPartialRow&>(row).GetUnscaledDecimal("decimal_val",
+      &decValFromConst));
+  EXPECT_EQ(123456, decValFromConst);
+
+  // Get a decimal value the backward compatible non-const version of the function.
+  int128_t decValFromNonConst;
+  EXPECT_OK(row.GetUnscaledDecimal("decimal_val", &decValFromNonConst));
+  EXPECT_EQ(123456, decValFromNonConst);
+
   // Set the max decimal value for the decimal_val column
   EXPECT_OK(row.SetUnscaledDecimal("decimal_val", 999999));
   EXPECT_EQ("decimal decimal_val=999999_D32", row.ToString());
diff --git a/src/kudu/common/partial_row.cc b/src/kudu/common/partial_row.cc
index cb422f5..07719f8 100644
--- a/src/kudu/common/partial_row.cc
+++ b/src/kudu/common/partial_row.cc
@@ -650,6 +650,10 @@ Status KuduPartialRow::GetFloat(const Slice& col_name, float* val) const {
 Status KuduPartialRow::GetDouble(const Slice& col_name, double* val) const {
   return Get<TypeTraits<DOUBLE> >(col_name, val);
 }
+Status KuduPartialRow::GetUnscaledDecimal(const Slice &col_name, int128_t *val) {
+  // Call the const version of the function.
+  return const_cast<const KuduPartialRow*>(this)->GetUnscaledDecimal(col_name, val);
+}
 Status KuduPartialRow::GetUnscaledDecimal(const Slice &col_name, int128_t *val) const {
   int col_idx;
   RETURN_NOT_OK(FindColumn(*schema_, col_name, &col_idx));
@@ -686,6 +690,10 @@ Status KuduPartialRow::GetFloat(int col_idx, float* val) const {
 Status KuduPartialRow::GetDouble(int col_idx, double* val) const {
   return Get<TypeTraits<DOUBLE> >(col_idx, val);
 }
+Status KuduPartialRow::GetUnscaledDecimal(int col_idx, int128_t *val) {
+  // Call the const version of the function.
+  return const_cast<const KuduPartialRow*>(this)->GetUnscaledDecimal(col_idx, val);
+}
 Status KuduPartialRow::GetUnscaledDecimal(int col_idx, int128_t *val) const {
   const ColumnSchema& col = schema_->column(col_idx);
   const DataType col_type = col.type_info()->type();
diff --git a/src/kudu/common/partial_row.h b/src/kudu/common/partial_row.h
index 3dca69d..11698f4 100644
--- a/src/kudu/common/partial_row.h
+++ b/src/kudu/common/partial_row.h
@@ -361,6 +361,8 @@ class KUDU_EXPORT KuduPartialRow {
   Status GetFloat(const Slice& col_name, float* val) const WARN_UNUSED_RESULT;
   Status GetDouble(const Slice& col_name, double* val) const WARN_UNUSED_RESULT;
 #if KUDU_INT128_SUPPORTED
+  // NOTE: The non-const version of this function is kept for backwards compatibility.
+  Status GetUnscaledDecimal(const Slice& col_name, int128_t* val) WARN_UNUSED_RESULT;
   Status GetUnscaledDecimal(const Slice& col_name, int128_t* val) const WARN_UNUSED_RESULT;
 #endif
   ///@}
@@ -394,6 +396,8 @@ class KUDU_EXPORT KuduPartialRow {
   Status GetFloat(int col_idx, float* val) const WARN_UNUSED_RESULT;
   Status GetDouble(int col_idx, double* val) const WARN_UNUSED_RESULT;
 #if KUDU_INT128_SUPPORTED
+  // NOTE: The non-const version of this function is kept for backwards compatibility.
+  Status GetUnscaledDecimal(int col_idx, int128_t* val) WARN_UNUSED_RESULT;
   Status GetUnscaledDecimal(int col_idx, int128_t* val) const WARN_UNUSED_RESULT;
 #endif
   ///@}


[kudu] 01/02: [rebalancer] fix LOG() misprint in rebalancer

Posted by gr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5f3470a77aba10d8c784405bda987a01d6b33035
Author: Yingchun Lai <40...@qq.com>
AuthorDate: Tue Feb 12 10:50:54 2019 +0800

    [rebalancer] fix LOG() misprint in rebalancer
    
    Fix misprint of table name and table id.
    This changelist does not contain any functional modifications.
    
    Change-Id: Id58029e11adc06b556821eac56a3ee19d873efb7
    Reviewed-on: http://gerrit.cloudera.org:8080/12453
    Reviewed-by: Todd Lipcon <to...@apache.org>
    Tested-by: Todd Lipcon <to...@apache.org>
---
 src/kudu/tools/rebalancer.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kudu/tools/rebalancer.cc b/src/kudu/tools/rebalancer.cc
index a1548b4..4291806 100644
--- a/src/kudu/tools/rebalancer.cc
+++ b/src/kudu/tools/rebalancer.cc
@@ -741,7 +741,7 @@ Status Rebalancer::BuildClusterInfo(const ClusterRawInfo& raw_info,
   for (const auto& tablet : raw_info.tablet_summaries) {
     if (!config_.move_rf1_replicas) {
       if (rf1_tables.find(tablet.table_id) != rf1_tables.end()) {
-        LOG(INFO) << Substitute("tablet $0 of table '$0' ($1) has single replica, skipping",
+        LOG(INFO) << Substitute("tablet $0 of table '$1' ($2) has single replica, skipping",
                                 tablet.id, tablet.table_name, tablet.table_id);
         continue;
       }