kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpe...@apache.org
Subject [1/3] kudu git commit: Support decimal columns in load generation tool
Date Wed, 21 Feb 2018 00:10:42 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 9c70e0751 -> 270dd9996


Support decimal columns in load generation tool

Change-Id: I8f9441ab3483775e74f5fdedfff309bdcbc8ab17
Reviewed-on: http://gerrit.cloudera.org:8080/9362
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/e0e440ef
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/e0e440ef
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/e0e440ef

Branch: refs/heads/master
Commit: e0e440eff66b3da7f456ae01b15eefae3fccfd45
Parents: 9c70e07
Author: Grant Henke <granthenke@gmail.com>
Authored: Mon Feb 19 17:06:44 2018 -0600
Committer: Grant Henke <granthenke@gmail.com>
Committed: Tue Feb 20 20:29:04 2018 +0000

----------------------------------------------------------------------
 src/kudu/tools/kudu-tool-test.cc   |  9 +++++++++
 src/kudu/tools/tool_action_perf.cc | 14 ++++++++++++++
 2 files changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/e0e440ef/src/kudu/tools/kudu-tool-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc
index c8cb27f..de8acf8 100644
--- a/src/kudu/tools/kudu-tool-test.cc
+++ b/src/kudu/tools/kudu-tool-test.cc
@@ -1339,6 +1339,15 @@ void ToolTest::RunLoadgen(int num_tservers,
         ColumnSchema("int64_val", INT64),
         ColumnSchema("float_val", FLOAT),
         ColumnSchema("double_val", DOUBLE),
+        ColumnSchema("decimal32_val", DECIMAL32, false,
+                     NULL, NULL, ColumnStorageAttributes(),
+                     ColumnTypeAttributes(9, 9)),
+        ColumnSchema("decimal64_val", DECIMAL64, false,
+                     NULL, NULL, ColumnStorageAttributes(),
+                     ColumnTypeAttributes(18, 2)),
+        ColumnSchema("decimal128_val", DECIMAL128, false,
+                     NULL, NULL, ColumnStorageAttributes(),
+                     ColumnTypeAttributes(38, 0)),
         ColumnSchema("unixtime_micros_val", UNIXTIME_MICROS),
         ColumnSchema("string_val", STRING),
         ColumnSchema("binary_val", BINARY),

http://git-wip-us.apache.org/repos/asf/kudu/blob/e0e440ef/src/kudu/tools/tool_action_perf.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action_perf.cc b/src/kudu/tools/tool_action_perf.cc
index 1e4e30c..7c23bc8 100644
--- a/src/kudu/tools/tool_action_perf.cc
+++ b/src/kudu/tools/tool_action_perf.cc
@@ -137,6 +137,8 @@
 #include "kudu/gutil/strings/split.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/tools/tool_action_common.h"
+#include "kudu/util/decimal_util.h"
+#include "kudu/util/int128.h"
 #include "kudu/util/oid_generator.h"
 #include "kudu/util/random.h"
 #include "kudu/util/status.h"
@@ -350,6 +352,18 @@ Status GenerateRowData(Generator* gen, KuduPartialRow* row,
       case DOUBLE:
         RETURN_NOT_OK(row->SetDouble(idx, gen->Next<double>()));
         break;
+      case DECIMAL32:
+        RETURN_NOT_OK(row->SetUnscaledDecimal(idx, std::min(gen->Next<int32_t>(),
+                                                              kMaxUnscaledDecimal32)));
+        break;
+      case DECIMAL64:
+        RETURN_NOT_OK(row->SetUnscaledDecimal(idx, std::min(gen->Next<int64_t>(),
+                                                            kMaxUnscaledDecimal64)));
+        break;
+      case DECIMAL128:
+        RETURN_NOT_OK(row->SetUnscaledDecimal(idx, std::min(gen->Next<int128_t>(),
+                                                            kMaxUnscaledDecimal128)));
+        break;
       case BINARY:
         if (fixed_string.empty()) {
           RETURN_NOT_OK(row->SetBinary(idx, gen->Next<string>()));


Mime
View raw message