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 2017/02/06 21:11:04 UTC
[2/7] incubator-impala git commit: IMPALA-4810: Add DECIMAL_V2 query
option
IMPALA-4810: Add DECIMAL_V2 query option
This query option is going to be used to change both rounding semantics
and establish more appropriate output types for multiply / divide.
The option won't be supported until all the changes are complete,
but this will eventually become the default behavior for DECIMAL.
Change-Id: I6cf25fe5c1766c86ebfe196d49f646e81e50a24e
Reviewed-on: http://gerrit.cloudera.org:8080/5889
Reviewed-by: Michael Ho <kw...@cloudera.com>
Reviewed-by: Dan Hecht <dh...@cloudera.com>
Tested-by: Impala Public 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/0f8ae355
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/0f8ae355
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/0f8ae355
Branch: refs/heads/master
Commit: 0f8ae355cee00e1d7b0ee47814d31f7337926bcc
Parents: 7704b64
Author: Zach Amsden <za...@cloudera.com>
Authored: Fri Feb 3 03:40:53 2017 +0000
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Sat Feb 4 01:13:35 2017 +0000
----------------------------------------------------------------------
be/src/service/query-options.cc | 4 ++++
be/src/service/query-options.h | 6 ++++--
common/thrift/ImpalaInternalService.thrift | 3 +++
common/thrift/ImpalaService.thrift | 8 ++++++--
4 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/0f8ae355/be/src/service/query-options.cc
----------------------------------------------------------------------
diff --git a/be/src/service/query-options.cc b/be/src/service/query-options.cc
index 8be6b19..7227387 100644
--- a/be/src/service/query-options.cc
+++ b/be/src/service/query-options.cc
@@ -446,6 +446,10 @@ Status impala::SetQueryOption(const string& key, const string& value,
iequals(value, "true") || iequals(value, "1"));
break;
}
+ case TImpalaQueryOptions::DECIMAL_V2: {
+ query_options->__set_decimal_v2(iequals(value, "true") || iequals(value, "1"));
+ break;
+ }
default:
// We hit this DCHECK(false) if we forgot to add the corresponding entry here
// when we add a new query option.
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/0f8ae355/be/src/service/query-options.h
----------------------------------------------------------------------
diff --git a/be/src/service/query-options.h b/be/src/service/query-options.h
index 6531dcb..d4fcd96 100644
--- a/be/src/service/query-options.h
+++ b/be/src/service/query-options.h
@@ -35,7 +35,7 @@ class TQueryOptions;
// the DCHECK.
#define QUERY_OPTS_TABLE\
DCHECK_EQ(_TImpalaQueryOptions_VALUES_TO_NAMES.size(),\
- TImpalaQueryOptions::ENABLE_EXPR_REWRITES + 1);\
+ TImpalaQueryOptions::DECIMAL_V2 + 1);\
QUERY_OPT_FN(abort_on_default_limit_exceeded, ABORT_ON_DEFAULT_LIMIT_EXCEEDED)\
QUERY_OPT_FN(abort_on_error, ABORT_ON_ERROR)\
QUERY_OPT_FN(allow_unsupported_formats, ALLOW_UNSUPPORTED_FORMATS)\
@@ -86,7 +86,9 @@ class TQueryOptions;
QUERY_OPT_FN(prefetch_mode, PREFETCH_MODE)\
QUERY_OPT_FN(strict_mode, STRICT_MODE)\
QUERY_OPT_FN(scratch_limit, SCRATCH_LIMIT)\
- QUERY_OPT_FN(enable_expr_rewrites, ENABLE_EXPR_REWRITES);
+ QUERY_OPT_FN(enable_expr_rewrites, ENABLE_EXPR_REWRITES)\
+ QUERY_OPT_FN(decimal_v2, DECIMAL_V2)\
+ ;
/// Converts a TQueryOptions struct into a map of key, value pairs.
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/0f8ae355/common/thrift/ImpalaInternalService.thrift
----------------------------------------------------------------------
diff --git a/common/thrift/ImpalaInternalService.thrift b/common/thrift/ImpalaInternalService.thrift
index 5088a1b..e9b962e 100644
--- a/common/thrift/ImpalaInternalService.thrift
+++ b/common/thrift/ImpalaInternalService.thrift
@@ -218,6 +218,9 @@ struct TQueryOptions {
// Indicates whether the FE should rewrite Exprs for optimization purposes.
// It's sometimes useful to disable rewrites for testing, e.g., expr-test.cc.
51: optional bool enable_expr_rewrites = true
+
+ // Indicates whether to use the new decimal semantics.
+ 52: optional bool decimal_v2 = false
}
// Impala currently has two types of sessions: Beeswax and HiveServer2
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/0f8ae355/common/thrift/ImpalaService.thrift
----------------------------------------------------------------------
diff --git a/common/thrift/ImpalaService.thrift b/common/thrift/ImpalaService.thrift
index ac1cf4a..98c671d 100644
--- a/common/thrift/ImpalaService.thrift
+++ b/common/thrift/ImpalaService.thrift
@@ -242,11 +242,15 @@ enum TImpalaQueryOptions {
// A limit on the amount of scratch directory space that can be used;
// Unspecified or a limit of -1 means no limit;
// Otherwise specified in the same way as MEM_LIMIT.
- SCRATCH_LIMIT
+ SCRATCH_LIMIT,
// Indicates whether the FE should rewrite Exprs for optimization purposes.
// It's sometimes useful to disable rewrites for testing, e.g., expr-test.cc.
- ENABLE_EXPR_REWRITES
+ ENABLE_EXPR_REWRITES,
+
+ // Indicates whether to use the new decimal semantics, which includes better
+ // rounding and output types for multiply / divide
+ DECIMAL_V2,
}
// The summary of a DML statement.