You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2016/07/07 06:41:11 UTC

incubator-impala git commit: IMPALA-3799: Make MAX_SCAN_RANGE_LENGTH accept formatted quantities

Repository: incubator-impala
Updated Branches:
  refs/heads/master a07021775 -> f407288d7


IMPALA-3799: Make MAX_SCAN_RANGE_LENGTH accept formatted quantities

This patch changes MAX_SCAN_RANGE_LENGTH to accept formatted quantities
like 4MB.

Change-Id: I2703f7ddaa74c4256a3d4a545012332dfbf5fed8
Reviewed-on: http://gerrit.cloudera.org:8080/3573
Reviewed-by: Lars Volker <lv...@cloudera.com>
Reviewed-by: Henry Robinson <he...@cloudera.com>
Tested-by: Henry Robinson <he...@cloudera.com>


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

Branch: refs/heads/master
Commit: f407288d7b53da337abd8aac4ac6988d2c428a9c
Parents: a070217
Author: Henry Robinson <he...@cloudera.com>
Authored: Tue Jul 5 13:07:12 2016 -0700
Committer: Tim Armstrong <ta...@cloudera.com>
Committed: Wed Jul 6 23:41:04 2016 -0700

----------------------------------------------------------------------
 be/src/service/query-options-test.cc | 25 +++++++++++++++++++++++++
 be/src/service/query-options.cc      |  7 +++++--
 2 files changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f407288d/be/src/service/query-options-test.cc
----------------------------------------------------------------------
diff --git a/be/src/service/query-options-test.cc b/be/src/service/query-options-test.cc
index f1d90c0..82b8f6b 100644
--- a/be/src/service/query-options-test.cc
+++ b/be/src/service/query-options-test.cc
@@ -18,6 +18,7 @@
 #include <inttypes.h>
 #include <gtest/gtest.h>
 #include <string>
+#include <gutil/strings/substitute.h>
 
 #include "runtime/runtime-filter.h"
 #include "testutil/gtest-util.h"
@@ -26,6 +27,7 @@
 using namespace boost;
 using namespace impala;
 using namespace std;
+using namespace strings;
 
 TEST(QueryOptions, SetBloomSize) {
   TQueryOptions options;
@@ -80,6 +82,29 @@ TEST(QueryOptions, SetFilterWait) {
   EXPECT_EQ(numeric_limits<int32_t>::max(), options.runtime_filter_wait_time_ms);
 }
 
+TEST(QueryOptions, MaxScanRangeLength) {
+  vector<pair<string, int64_t>> vals = {{"4GB", 4L * 1024 * 1024 * 1024},
+                                        {"-1M", -1},
+                                        {"0B", 0},
+                                        {"1024", 1024},
+                                        {"9223372036854775807", 9223372036854775807},
+                                        {"9223372036854775808", -1}, // 2**63
+                                        {"Not a number!", -1}};
+  for (const auto& val: vals) {
+    TQueryOptions options;
+    QueryOptionsMask mask;
+    Status status = ParseQueryOptions(
+        Substitute("MAX_SCAN_RANGE_LENGTH=$0", val.first), &options, &mask);
+    int64_t expected = val.second;
+    if (expected == -1) {
+      EXPECT_FALSE(status.ok());
+    } else {
+      EXPECT_OK(status);
+      EXPECT_EQ(expected, options.max_scan_range_length);
+    }
+  }
+}
+
 TEST(QueryOptions, ParseQueryOptions) {
   QueryOptionsMask expectedMask;
   expectedMask.set(TImpalaQueryOptions::NUM_NODES);

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f407288d/be/src/service/query-options.cc
----------------------------------------------------------------------
diff --git a/be/src/service/query-options.cc b/be/src/service/query-options.cc
index b82b5c3..bdfb831 100644
--- a/be/src/service/query-options.cc
+++ b/be/src/service/query-options.cc
@@ -134,9 +134,12 @@ Status impala::SetQueryOption(const string& key, const string& value,
       case TImpalaQueryOptions::NUM_NODES:
         query_options->__set_num_nodes(atoi(value.c_str()));
         break;
-      case TImpalaQueryOptions::MAX_SCAN_RANGE_LENGTH:
-        query_options->__set_max_scan_range_length(atol(value.c_str()));
+      case TImpalaQueryOptions::MAX_SCAN_RANGE_LENGTH: {
+        int64_t scan_length = 0;
+        RETURN_IF_ERROR(ParseMemValue(value, "scan range length", &scan_length));
+        query_options->__set_max_scan_range_length(scan_length);
         break;
+      }
       case TImpalaQueryOptions::MAX_IO_BUFFERS:
         query_options->__set_max_io_buffers(atoi(value.c_str()));
         break;