diff --git itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java index 1ea85ebee3..2ad2a31905 100644 --- itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java +++ itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java @@ -404,7 +404,7 @@ public void testIncrementalMetadataReplication() throws Throwable { }) .run("show tblproperties table3('custom.property')") .verifyResults(new String[] { - "custom.value\t " + "custom.property\tcustom.value" }); } @@ -676,7 +676,7 @@ public void testReplLoadFromSourceUsingWithClause() throws Throwable { "country \tstring \t ", }) .run("show tblproperties table3('custom.property')") - .verifyResults(new String[] { "custom.value\t " }) + .verifyResults(new String[] { "custom.property\tcustom.value" }) .run("select id from table2 order by id") .verifyResults(new String[] { "1" }) .run("select * from table3") @@ -981,7 +981,7 @@ public void testIfCkptAndSourceOfReplPropsIgnoredByReplDump() throws Throwable { .run("repl status " + replicatedDbName) .verifyResult(tuplePrimary.lastReplicationId) .run("show tblproperties t1('custom.property')") - .verifyResults(new String[] { "custom.value\t " }) + .verifyResults(new String[] { "custom.property\tcustom.value" }) .dumpFailure(replicatedDbName, null) .run("alter database " + replicatedDbName + " set dbproperties ('" + SOURCE_OF_REPLICATION + "' = '1, 2, 3')") @@ -998,7 +998,7 @@ public void testIfCkptAndSourceOfReplPropsIgnoredByReplDump() throws Throwable { .run("select country from t1") .verifyResults(Arrays.asList("india")) .run("show tblproperties t1('custom.property')") - .verifyResults(new String[] { "custom.value\t " }); + .verifyResults(new String[] { "custom.property\tcustom.value" }); // Check if DB/table/partition in C doesn't have repl.source.for props. Also ensure, ckpt property // is set to bootstrap dump location used in C. @@ -1037,7 +1037,7 @@ public void testIfCkptAndSourceOfReplPropsIgnoredByReplDump() throws Throwable { .run("repl status " + replDbFromReplica) .verifyResult(tupleReplicaInc.lastReplicationId) .run("show tblproperties t1('custom.property')") - .verifyResults(new String[] { "custom.value\t " }); + .verifyResults(new String[] { "custom.property\tcustom.value" }); // Check if DB/table/partition in C doesn't have repl.source.for props. Also ensure, ckpt property // in DB is set to bootstrap dump location used in C but for table/partition, it is missing. diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java index e91346228e..cac0988533 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java @@ -3560,7 +3560,8 @@ private int showTableProperties(Hive db, ShowTblPropertiesDesc showTblPrpt) thro builder.append(errMsg); } else { - builder.append(propertyValue); + appendNonNull(builder, propertyName, true); + appendNonNull(builder, propertyValue); } } else { diff --git ql/src/test/results/clientpositive/show_tblproperties.q.out ql/src/test/results/clientpositive/show_tblproperties.q.out index 83e1ebddc7..d09fd4c464 100644 --- ql/src/test/results/clientpositive/show_tblproperties.q.out +++ ql/src/test/results/clientpositive/show_tblproperties.q.out @@ -51,7 +51,7 @@ PREHOOK: query: show tblproperties tmpfoo("bar") PREHOOK: type: SHOW_TBLPROPERTIES POSTHOOK: query: show tblproperties tmpfoo("bar") POSTHOOK: type: SHOW_TBLPROPERTIES -bar value +bar bar value PREHOOK: query: show tblproperties default.tmpfoo PREHOOK: type: SHOW_TBLPROPERTIES POSTHOOK: query: show tblproperties default.tmpfoo @@ -71,7 +71,7 @@ PREHOOK: query: show tblproperties default.tmpfoo("bar") PREHOOK: type: SHOW_TBLPROPERTIES POSTHOOK: query: show tblproperties default.tmpfoo("bar") POSTHOOK: type: SHOW_TBLPROPERTIES -bar value +bar bar value PREHOOK: query: CREATE DATABASE db1 PREHOOK: type: CREATEDATABASE PREHOOK: Output: database:db1 @@ -127,7 +127,7 @@ PREHOOK: query: show tblproperties default.tmpfoo("bar") PREHOOK: type: SHOW_TBLPROPERTIES POSTHOOK: query: show tblproperties default.tmpfoo("bar") POSTHOOK: type: SHOW_TBLPROPERTIES -bar value +bar bar value PREHOOK: query: show tblproperties tmpfoo PREHOOK: type: SHOW_TBLPROPERTIES POSTHOOK: query: show tblproperties tmpfoo @@ -147,7 +147,7 @@ PREHOOK: query: show tblproperties tmpfoo("bar") PREHOOK: type: SHOW_TBLPROPERTIES POSTHOOK: query: show tblproperties tmpfoo("bar") POSTHOOK: type: SHOW_TBLPROPERTIES -bar value1 +bar bar value1 PREHOOK: query: use default PREHOOK: type: SWITCHDATABASE PREHOOK: Input: database:default @@ -173,4 +173,4 @@ PREHOOK: query: show tblproperties db1.tmpfoo("bar") PREHOOK: type: SHOW_TBLPROPERTIES POSTHOOK: query: show tblproperties db1.tmpfoo("bar") POSTHOOK: type: SHOW_TBLPROPERTIES -bar value1 +bar bar value1