impala-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jruss...@apache.org
Subject [1/6] incubator-impala git commit: IMPALA-6173: Fix SHOW CREATE TABLE for unpartitioned Kudu tables
Date Mon, 13 Nov 2017 22:11:22 GMT
Repository: incubator-impala
Updated Branches:
  refs/heads/master b4ea57a7e -> 6a2b7a64f


IMPALA-6173: Fix SHOW CREATE TABLE for unpartitioned Kudu tables

IMPALA-5546 added the ability to create unpartitioned Kudu tables, but
when SHOW CREATE TABLE is run on it still prints 'PARTITION BY' just
without a partition clause. This patch removes the 'PARTITION BY' from
the output.

Testing:
- Added test that runs SHOW CREATE on an unpartitioned Kudu table.

Change-Id: Icc327266cfb8b5c05efec97348528cea6904bb20
Reviewed-on: http://gerrit.cloudera.org:8080/8506
Reviewed-by: Alex Behm <alex.behm@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/3a1073c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/3a1073c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/3a1073c8

Branch: refs/heads/master
Commit: 3a1073c87c6ea08d9e8e2367851775748495300f
Parents: b4ea57a
Author: Thomas Tauber-Marshall <tmarshall@cloudera.com>
Authored: Wed Nov 8 14:41:38 2017 -0800
Committer: Impala Public Jenkins <impala-public-jenkins@gerrit.cloudera.org>
Committed: Thu Nov 9 23:59:13 2017 +0000

----------------------------------------------------------------------
 .../java/org/apache/impala/analysis/ToSqlUtils.java     |  2 +-
 tests/query_test/test_kudu.py                           | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/3a1073c8/fe/src/main/java/org/apache/impala/analysis/ToSqlUtils.java
----------------------------------------------------------------------
diff --git a/fe/src/main/java/org/apache/impala/analysis/ToSqlUtils.java b/fe/src/main/java/org/apache/impala/analysis/ToSqlUtils.java
index 471947c..facebfd 100644
--- a/fe/src/main/java/org/apache/impala/analysis/ToSqlUtils.java
+++ b/fe/src/main/java/org/apache/impala/analysis/ToSqlUtils.java
@@ -320,7 +320,7 @@ public class ToSqlUtils {
           Joiner.on(", \n  ").join(partitionColumnsSql)));
     }
 
-    if (kuduPartitionByParams != null) {
+    if (kuduPartitionByParams != null && !kuduPartitionByParams.equals("")) {
       sb.append("PARTITION BY " + kuduPartitionByParams + "\n");
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/3a1073c8/tests/query_test/test_kudu.py
----------------------------------------------------------------------
diff --git a/tests/query_test/test_kudu.py b/tests/query_test/test_kudu.py
index b951237..27ee757 100644
--- a/tests/query_test/test_kudu.py
+++ b/tests/query_test/test_kudu.py
@@ -805,6 +805,18 @@ class TestShowCreateTable(KuduTestSuite):
         STORED AS KUDU
         TBLPROPERTIES ('kudu.master_addresses'='{kudu_addr}')""".format(
             db=cursor.conn.db_name, kudu_addr=KUDU_MASTER_HOSTS))
+    self.assert_show_create_equals(cursor,
+        """
+        CREATE TABLE {table} (c INT PRIMARY KEY) STORED AS KUDU""",
+        """
+        CREATE TABLE {db}.{{table}} (
+          c INT NOT NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION,
+          PRIMARY KEY (c)
+        )
+        STORED AS KUDU
+        TBLPROPERTIES ('kudu.master_addresses'='{kudu_addr}')""".format(
+            db=cursor.conn.db_name, kudu_addr=KUDU_MASTER_HOSTS))
+
 
   def test_timestamp_default_value(self, cursor):
     create_sql_fmt = """


Mime
View raw message