This is an automated email from the ASF dual-hosted git repository.

zabetak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new aa91e92e2b4 HIVE-29259: Remove label from text based output for desc 
catalog (#6228)
aa91e92e2b4 is described below

commit aa91e92e2b4a7f47178b78ff11d147115c825f66
Author: Raghav Aggarwal <[email protected]>
AuthorDate: Tue Dec 16 18:10:56 2025 +0530

    HIVE-29259: Remove label from text based output for desc catalog (#6228)
---
 .../test/resources/testconfiguration.properties    |  1 +
 .../ql/ddl/catalog/desc/DescCatalogFormatter.java  | 19 ++++++++-----------
 ql/src/test/queries/clientpositive/catalog.q       | 13 ++++++++-----
 .../test/results/clientpositive/llap/catalog.q.out | 22 ++++++++++++----------
 4 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/itests/src/test/resources/testconfiguration.properties 
b/itests/src/test/resources/testconfiguration.properties
index d294c1bd26c..a1ea7acea44 100644
--- a/itests/src/test/resources/testconfiguration.properties
+++ b/itests/src/test/resources/testconfiguration.properties
@@ -58,6 +58,7 @@ minillap.query.files=\
   binary_output_format.q,\
   bucket5.q,\
   bucket6.q,\
+  catalog.q,\
   cmv_direct.q,\
   cmv_direct_with_specified_locations.q,\
   cmv_direct_with_suffixed_locations.q,\
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/ddl/catalog/desc/DescCatalogFormatter.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/ddl/catalog/desc/DescCatalogFormatter.java
index c89e23b5c34..def70c3046a 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/ddl/catalog/desc/DescCatalogFormatter.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/ddl/catalog/desc/DescCatalogFormatter.java
@@ -66,27 +66,24 @@ static class TextDescCatalogFormatter extends 
DescCatalogFormatter {
     void showCatalogDescription(DataOutputStream out, String catalog, String 
comment, String location,
         int createTime) throws HiveException {
       try {
-        writeLine(out, "Catalog Name", catalog);
+        out.write(catalog.getBytes(StandardCharsets.UTF_8));
+        out.write(Utilities.tabCode);
         if (comment != null) {
-          writeLine(out, "Comment", HiveStringUtils.escapeJava(comment));
+          
out.write(HiveStringUtils.escapeJava(comment).getBytes(StandardCharsets.UTF_8));
         }
+        out.write(Utilities.tabCode);
         if (location != null) {
-          writeLine(out, "Location", location);
+          out.write(location.getBytes(StandardCharsets.UTF_8));
         }
+        out.write(Utilities.tabCode);
         if (createTime != 0) {
           String createTimeStr = CalendarUtils.formatTimestamp((long) 
createTime * 1000, true);
-          writeLine(out, "CreateTime", createTimeStr);
+          out.write(createTimeStr.getBytes(StandardCharsets.UTF_8));
         }
+        out.write(Utilities.newLineCode);
       } catch (IOException e) {
         throw new HiveException(e);
       }
     }
-
-    private void writeLine(DataOutputStream out, String label, String value) 
throws IOException {
-      out.write(label.getBytes(StandardCharsets.UTF_8));
-      out.write(Utilities.tabCode);
-      out.write(value.getBytes(StandardCharsets.UTF_8));
-      out.write(Utilities.newLineCode);
-    }
   }
 }
diff --git a/ql/src/test/queries/clientpositive/catalog.q 
b/ql/src/test/queries/clientpositive/catalog.q
index 0042bc377fd..9e8a0db5ae6 100644
--- a/ql/src/test/queries/clientpositive/catalog.q
+++ b/ql/src/test/queries/clientpositive/catalog.q
@@ -1,17 +1,20 @@
 set hive.mapred.mode=nonstrict;
 set hive.support.concurrency = true;
+--! qt:replace:/\d{4}-\d{2}-\d{2}.*/#Masked#/
+
+dfs -mkdir -p hdfs:///tmp/test_cat;
 
 -- SORT_QUERY_RESULTS
 SHOW CATALOGS;
 
 -- CREATE with comment
-CREATE CATALOG test_cat LOCATION '/tmp/test_cat' COMMENT 'Hive test catalog';
+CREATE CATALOG test_cat LOCATION 'hdfs:///tmp/test_cat' COMMENT 'Hive test 
catalog';
 
 -- DESCRIBE
 DESC CATALOG test_cat;
 
 -- CREATE INE already exists
-CREATE CATALOG IF NOT EXISTS test_cat LOCATION '/tmp/test_cat';
+CREATE CATALOG IF NOT EXISTS test_cat LOCATION 'hdfs:///tmp/test_cat';
 SHOW CATALOGS;
 
 -- DROP
@@ -19,7 +22,7 @@ DROP CATALOG test_cat;
 SHOW CATALOGS;
 
 -- CREATE INE doesn't exist
-CREATE CATALOG IF NOT EXISTS test_cat LOCATION '/tmp/test_cat' COMMENT 'Hive 
test catalog' PROPERTIES('key1'='value1');;
+CREATE CATALOG IF NOT EXISTS test_cat LOCATION 'hdfs:///tmp/test_cat' COMMENT 
'Hive test catalog' PROPERTIES('key1'='value1');;
 SHOW CATALOGS;
 
 -- DROP IE exists
@@ -30,7 +33,7 @@ SHOW CATALOGS;
 DROP CATALOG IF EXISTS test_cat;
 
 -- SHOW
-CREATE CATALOG test_cat LOCATION '/tmp/test_cat' COMMENT 'Hive test catalog';
+CREATE CATALOG test_cat LOCATION 'hdfs:///tmp/test_cat' COMMENT 'Hive test 
catalog';
 SHOW CATALOGS;
 
 -- SHOW pattern
@@ -43,7 +46,7 @@ SHOW CATALOGS LIKE 'test_';
 SHOW CATALOGS LIKE 'test__';
 
 -- ALTER LOCATION
-ALTER CATALOG test_cat SET LOCATION '/tmp/test_cat_new';
+ALTER CATALOG test_cat SET LOCATION 'hdfs:///tmp/test_cat_new';
 DESC CATALOG EXTENDED test_cat;
 
 -- ALTER PROPERTIES.
diff --git a/ql/src/test/results/clientpositive/llap/catalog.q.out 
b/ql/src/test/results/clientpositive/llap/catalog.q.out
index 8b66419d7ab..b2c2bd1cea7 100644
--- a/ql/src/test/results/clientpositive/llap/catalog.q.out
+++ b/ql/src/test/results/clientpositive/llap/catalog.q.out
@@ -6,25 +6,26 @@ hive
 #### A masked pattern was here ####
 PREHOOK: type: CREATECATALOG
 PREHOOK: Output: catalog:test_cat
+PREHOOK: Output: hdfs://### HDFS PATH ###
 #### A masked pattern was here ####
 POSTHOOK: type: CREATECATALOG
 POSTHOOK: Output: catalog:test_cat
-#### A masked pattern was here ####
+POSTHOOK: Output: hdfs://### HDFS PATH ###
 PREHOOK: query: DESC CATALOG test_cat
 PREHOOK: type: DESCCATALOG
 PREHOOK: Input: catalog:test_cat
 POSTHOOK: query: DESC CATALOG test_cat
 POSTHOOK: type: DESCCATALOG
 POSTHOOK: Input: catalog:test_cat
-Catalog Name   test_cat         
-Comment        Hive test catalog        
+test_cat       Hive test catalog       hdfs://### HDFS PATH ###
 #### A masked pattern was here ####
 PREHOOK: type: CREATECATALOG
 PREHOOK: Output: catalog:test_cat
+PREHOOK: Output: hdfs://### HDFS PATH ###
 #### A masked pattern was here ####
 POSTHOOK: type: CREATECATALOG
 POSTHOOK: Output: catalog:test_cat
-#### A masked pattern was here ####
+POSTHOOK: Output: hdfs://### HDFS PATH ###
 PREHOOK: query: SHOW CATALOGS
 PREHOOK: type: SHOWCATALOGS
 POSTHOOK: query: SHOW CATALOGS
@@ -47,10 +48,11 @@ hive
 #### A masked pattern was here ####
 PREHOOK: type: CREATECATALOG
 PREHOOK: Output: catalog:test_cat
+PREHOOK: Output: hdfs://### HDFS PATH ###
 #### A masked pattern was here ####
 POSTHOOK: type: CREATECATALOG
 POSTHOOK: Output: catalog:test_cat
-#### A masked pattern was here ####
+POSTHOOK: Output: hdfs://### HDFS PATH ###
 PREHOOK: query: SHOW CATALOGS
 PREHOOK: type: SHOWCATALOGS
 POSTHOOK: query: SHOW CATALOGS
@@ -77,10 +79,11 @@ POSTHOOK: type: DROPCATALOG
 #### A masked pattern was here ####
 PREHOOK: type: CREATECATALOG
 PREHOOK: Output: catalog:test_cat
+PREHOOK: Output: hdfs://### HDFS PATH ###
 #### A masked pattern was here ####
 POSTHOOK: type: CREATECATALOG
 POSTHOOK: Output: catalog:test_cat
-#### A masked pattern was here ####
+POSTHOOK: Output: hdfs://### HDFS PATH ###
 PREHOOK: query: SHOW CATALOGS
 PREHOOK: type: SHOWCATALOGS
 POSTHOOK: query: SHOW CATALOGS
@@ -103,19 +106,18 @@ POSTHOOK: type: SHOWCATALOGS
 #### A masked pattern was here ####
 PREHOOK: type: ALTERCATALOG_LOCATION
 PREHOOK: Output: catalog:test_cat
+PREHOOK: Output: hdfs://### HDFS PATH ###
 #### A masked pattern was here ####
 POSTHOOK: type: ALTERCATALOG_LOCATION
 POSTHOOK: Output: catalog:test_cat
-#### A masked pattern was here ####
+POSTHOOK: Output: hdfs://### HDFS PATH ###
 PREHOOK: query: DESC CATALOG EXTENDED test_cat
 PREHOOK: type: DESCCATALOG
 PREHOOK: Input: catalog:test_cat
 POSTHOOK: query: DESC CATALOG EXTENDED test_cat
 POSTHOOK: type: DESCCATALOG
 POSTHOOK: Input: catalog:test_cat
-Catalog Name   test_cat                 
-Comment        Hive test catalog                
-#### A masked pattern was here ####
+test_cat       Hive test catalog       hdfs://### HDFS PATH ###        #Masked#
 PREHOOK: query: ALTER CATALOG test_cat SET PROPERTIES ('key2'='value2')
 PREHOOK: type: ALTERCATALOG_PROPERTIES
 PREHOOK: Output: catalog:test_cat

Reply via email to