[2/3] impala git commit: IMPALA-3916: Reserve SQL:2016 reserved words

2018-02-05 Thread tarmstrong
IMPALA-3916: Reserve SQL:2016 reserved words

This patch reserves SQL:2016 reserved words, excluding:
1. Impala builtin function names.
2. Time unit words(year, month, etc.).
3. An exception list based on a discussion.

Some test cases are modified to avoid these words. A impalad and
catalogd startup option reserved_words_version is added. The words are
reserved if the option is set to "3.0.0".

Change-Id: If1b295e6a77e840cf1b794c2eb73e1b9d2b8ddd6
Reviewed-on: http://gerrit.cloudera.org:8080/9096
Reviewed-by: Alex Behm 
Reviewed-by: Philip Zeyliger 
Tested-by: Impala Public Jenkins
(cherry picked from commit f0b3d9d122f2c6eb4137bf93e3512a489ff8fab0)

Change-Id: Ifd29d6aebe793d4eb37c092c1364f3acfebd91f8
Reviewed-on: http://gerrit.cloudera.org:8080/9198
Reviewed-by: Tianyi Wang 
Tested-by: Impala Public Jenkins


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

Branch: refs/heads/2.x
Commit: ecf972a5b1d933d5d4f9f8f7658e8df900594b06
Parents: 7097ee8
Author: Tianyi Wang 
Authored: Tue Jan 16 18:00:02 2018 -0800
Committer: Impala Public Jenkins 
Committed: Sun Feb 4 02:00:25 2018 +

--
 be/src/common/global-flags.cc   |   7 +-
 be/src/common/init.cc   |   9 +-
 be/src/util/backend-gflag-util.cc   |  11 +-
 common/thrift/BackendGflags.thrift  |   7 +
 fe/src/main/cup/sql-parser.cup  |  56 +-
 .../org/apache/impala/analysis/ToSqlUtils.java  |   7 +-
 .../org/apache/impala/catalog/BuiltinsDb.java   |   4 +-
 .../java/org/apache/impala/catalog/Catalog.java |  10 +-
 .../impala/catalog/CatalogServiceCatalog.java   |  11 +-
 .../main/java/org/apache/impala/catalog/Db.java |  18 +-
 .../apache/impala/catalog/ImpaladCatalog.java   |  14 +-
 .../apache/impala/service/BackendConfig.java|  12 +-
 fe/src/main/jflex/sql-scanner.flex  | 577 +++
 .../apache/impala/analysis/AnalyzeDDLTest.java  |  13 +-
 .../org/apache/impala/analysis/ToSqlTest.java   |  14 +-
 .../org/apache/impala/catalog/CatalogTest.java  |  12 +-
 .../apache/impala/common/FrontendTestBase.java  |   2 +-
 .../impala/planner/StatsExtrapolationTest.java  |  24 +-
 .../org/apache/impala/service/JdbcTest.java |   8 +-
 .../queries/QueryTest/empty-build-joins.test|  84 +--
 .../queries/QueryTest/exprs.test|  24 +-
 .../queries/QueryTest/partition-col-types.test  |   2 +-
 .../queries/QueryTest/single-node-nlj.test  |  24 +-
 .../queries/QueryTest/spilling-large-rows.test  |  16 +-
 .../queries/QueryTest/values.test   |   6 +-
 .../test_reserved_words_version.py  |  38 ++
 .../custom_cluster/test_stats_extrapolation.py  |   2 +-
 tests/query_test/test_sort.py   |   6 +-
 28 files changed, 573 insertions(+), 445 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/impala/blob/ecf972a5/be/src/common/global-flags.cc
--
diff --git a/be/src/common/global-flags.cc b/be/src/common/global-flags.cc
index d9d99c8..2d832da 100644
--- a/be/src/common/global-flags.cc
+++ b/be/src/common/global-flags.cc
@@ -182,10 +182,15 @@ DEFINE_int32(max_log_files, 10, "Maximum number of log 
files to retain per sever
 "retained.");
 
 // The read size is the preferred size of the reads issued to HDFS or the 
local FS.
-// There is a trade off of latency and throughout, trying to keep disks busy 
but
+// There is a trade off of latency and throughput, trying to keep disks busy 
but
 // not introduce seeks.  The literature seems to agree that with 8 MB reads, 
random
 // io and sequential io perform similarly.
 DEFINE_int32(read_size, 8 * 1024 * 1024, "(Advanced) The preferred I/O request 
size in "
 "bytes to issue to HDFS or the local filesystem. Increasing the read size 
will "
 "increase memory requirements. Decreasing the read size may decrease I/O "
 "throughput.");
+
+DEFINE_string(reserved_words_version, "3.0.0", "Reserved words compatibility 
version. "
+"Reserved words cannot be used as identifiers in SQL. This flag determines 
the impala"
+" version from which the reserved word list is taken. The value must be 
one of "
+"[\"2.11.0\", \"3.0.0\"].");

http://git-wip-us.apache.org/repos/asf/impala/blob/ecf972a5/be/src/common/init.cc
--
diff --git a/be/src/common/init.cc b/be/src/common/init.cc
index abbe416..41d4549 100644
--- a/be/src/common/init.cc
+++ b/be/src/common/init.cc
@@ -63,9 +63,10 @@ DECLARE_string(heap_profile_dir);
 DECLARE_string(hostname);
 // TODO: rename this to be more gene

[2/3] impala git commit: IMPALA-3916: Reserve SQL:2016 reserved words

2018-02-02 Thread philz
IMPALA-3916: Reserve SQL:2016 reserved words

This patch reserves SQL:2016 reserved words, excluding:
1. Impala builtin function names.
2. Time unit words(year, month, etc.).
3. An exception list based on a discussion.

Some test cases are modified to avoid these words. A impalad and
catalogd startup option reserved_words_version is added. The words are
reserved if the option is set to "3.0.0".

Change-Id: If1b295e6a77e840cf1b794c2eb73e1b9d2b8ddd6
Reviewed-on: http://gerrit.cloudera.org:8080/9096
Reviewed-by: Alex Behm 
Reviewed-by: Philip Zeyliger 
Tested-by: Impala Public Jenkins


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

Branch: refs/heads/master
Commit: f0b3d9d122f2c6eb4137bf93e3512a489ff8fab0
Parents: 4bd7cc8
Author: Tianyi Wang 
Authored: Tue Jan 16 18:00:02 2018 -0800
Committer: Impala Public Jenkins 
Committed: Fri Feb 2 01:13:08 2018 +

--
 be/src/common/global-flags.cc   |   7 +-
 be/src/common/init.cc   |   9 +-
 be/src/util/backend-gflag-util.cc   |  11 +-
 common/thrift/BackendGflags.thrift  |   7 +
 fe/src/main/cup/sql-parser.cup  |  56 +-
 .../org/apache/impala/analysis/ToSqlUtils.java  |   7 +-
 .../org/apache/impala/catalog/BuiltinsDb.java   |   4 +-
 .../java/org/apache/impala/catalog/Catalog.java |  10 +-
 .../impala/catalog/CatalogServiceCatalog.java   |  11 +-
 .../main/java/org/apache/impala/catalog/Db.java |  18 +-
 .../apache/impala/catalog/ImpaladCatalog.java   |  14 +-
 .../apache/impala/service/BackendConfig.java|  12 +-
 fe/src/main/jflex/sql-scanner.flex  | 577 +++
 .../apache/impala/analysis/AnalyzeDDLTest.java  |  13 +-
 .../impala/analysis/AnalyzeStmtsTest.java   |   6 +-
 .../org/apache/impala/analysis/ToSqlTest.java   |  14 +-
 .../org/apache/impala/catalog/CatalogTest.java  |  12 +-
 .../apache/impala/common/FrontendTestBase.java  |   2 +-
 .../impala/planner/StatsExtrapolationTest.java  |  24 +-
 .../org/apache/impala/service/JdbcTest.java |   8 +-
 .../queries/QueryTest/empty-build-joins.test|  84 +--
 .../queries/QueryTest/exprs.test|  16 +-
 .../queries/QueryTest/partition-col-types.test  |   2 +-
 .../queries/QueryTest/single-node-nlj.test  |  24 +-
 .../queries/QueryTest/spilling-large-rows.test  |  16 +-
 .../queries/QueryTest/values.test   |   6 +-
 .../test_reserved_words_version.py  |  38 ++
 .../custom_cluster/test_stats_extrapolation.py  |   2 +-
 tests/query_test/test_sort.py   |   6 +-
 29 files changed, 572 insertions(+), 444 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/impala/blob/f0b3d9d1/be/src/common/global-flags.cc
--
diff --git a/be/src/common/global-flags.cc b/be/src/common/global-flags.cc
index d9d99c8..2d832da 100644
--- a/be/src/common/global-flags.cc
+++ b/be/src/common/global-flags.cc
@@ -182,10 +182,15 @@ DEFINE_int32(max_log_files, 10, "Maximum number of log 
files to retain per sever
 "retained.");
 
 // The read size is the preferred size of the reads issued to HDFS or the 
local FS.
-// There is a trade off of latency and throughout, trying to keep disks busy 
but
+// There is a trade off of latency and throughput, trying to keep disks busy 
but
 // not introduce seeks.  The literature seems to agree that with 8 MB reads, 
random
 // io and sequential io perform similarly.
 DEFINE_int32(read_size, 8 * 1024 * 1024, "(Advanced) The preferred I/O request 
size in "
 "bytes to issue to HDFS or the local filesystem. Increasing the read size 
will "
 "increase memory requirements. Decreasing the read size may decrease I/O "
 "throughput.");
+
+DEFINE_string(reserved_words_version, "3.0.0", "Reserved words compatibility 
version. "
+"Reserved words cannot be used as identifiers in SQL. This flag determines 
the impala"
+" version from which the reserved word list is taken. The value must be 
one of "
+"[\"2.11.0\", \"3.0.0\"].");

http://git-wip-us.apache.org/repos/asf/impala/blob/f0b3d9d1/be/src/common/init.cc
--
diff --git a/be/src/common/init.cc b/be/src/common/init.cc
index abbe416..41d4549 100644
--- a/be/src/common/init.cc
+++ b/be/src/common/init.cc
@@ -63,9 +63,10 @@ DECLARE_string(heap_profile_dir);
 DECLARE_string(hostname);
 // TODO: rename this to be more generic when we have a good CM release to do 
so.
 DECLARE_int32(logbufsecs);
+DECLARE_int32(max_log_files);
 DECLARE_int32(max_minidumps);
 DECLARE_string(redaction_rules_fil