Index: ql/src/test/results/clientpositive/beeline/escape_comments.q.out IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- ql/src/test/results/clientpositive/beeline/escape_comments.q.out (revision 1a3090f858ce3ac18d1eb799d87a45b3ee0defce) +++ ql/src/test/results/clientpositive/beeline/escape_comments.q.out (revision ) @@ -11,13 +11,13 @@ POSTHOOK: type: SWITCHDATABASE POSTHOOK: Input: database:escape_comments_db PREHOOK: query: create table escape_comments_tbl1 -(col1 string comment 'a\nb\'\;') comment 'a\nb' +(col1 string comment 'a\nb\t\'\;') comment 'a\nb' partitioned by (p1 string comment 'a\nb') PREHOOK: type: CREATETABLE PREHOOK: Output: database:escape_comments_db PREHOOK: Output: escape_comments_db@escape_comments_tbl1 POSTHOOK: query: create table escape_comments_tbl1 -(col1 string comment 'a\nb\'\;') comment 'a\nb' +(col1 string comment 'a\nb\t\'\;') comment 'a\nb' partitioned by (p1 string comment 'a\nb') POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:escape_comments_db @@ -35,7 +35,7 @@ POSTHOOK: Output: database:escape_comments_db POSTHOOK: Output: escape_comments_db@escape_comments_view1 POSTHOOK: Lineage: escape_comments_view1.col1 SIMPLE [(escape_comments_tbl1)escape_comments_tbl1.FieldSchema(name:col1, type:string, comment:a -b';), ] +b ';), ] PREHOOK: query: describe database extended escape_comments_db PREHOOK: type: DESCDATABASE PREHOOK: Input: database:escape_comments_db @@ -57,7 +57,7 @@ POSTHOOK: type: SHOW_CREATETABLE POSTHOOK: Input: escape_comments_db@escape_comments_tbl1 CREATE TABLE `escape_comments_tbl1`( - `col1` string COMMENT 'a\nb\'\;') + `col1` string COMMENT 'a\nb\t\'\;') COMMENT 'a\nb' PARTITIONED BY ( `p1` string COMMENT 'a\nb') @@ -78,11 +78,11 @@ POSTHOOK: type: DESCTABLE POSTHOOK: Input: escape_comments_db@escape_comments_tbl1 # col_name data_type comment -col1 string a\nb'; +col1 string a\\nb\\t\\'\\; NULL NULL # Partition Information NULL NULL # col_name data_type comment -p1 string a\nb +p1 string a\\nb NULL NULL # Detailed Table Information NULL NULL Database: escape_comments_db NULL @@ -117,12 +117,12 @@ POSTHOOK: query: describe escape_comments_tbl1 POSTHOOK: type: DESCTABLE POSTHOOK: Input: escape_comments_db@escape_comments_tbl1 -col1 string a\nb'; -p1 string a\nb +col1 string a\\nb\\t\\'\\; +p1 string a\\nb NULL NULL # Partition Information NULL NULL # col_name data_type comment -p1 string a\nb +p1 string a\\nb PREHOOK: query: show create table escape_comments_view1 PREHOOK: type: SHOW_CREATETABLE PREHOOK: Input: escape_comments_db@escape_comments_view1 @@ -137,7 +137,7 @@ POSTHOOK: type: DESCTABLE POSTHOOK: Input: escape_comments_db@escape_comments_view1 # col_name data_type comment -col1 string a\nb +col1 string a\\nb NULL NULL # Detailed Table Information NULL NULL Database: escape_comments_db NULL Index: ql/src/test/results/clientpositive/escape_comments.q.out IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- ql/src/test/results/clientpositive/escape_comments.q.out (revision 1a3090f858ce3ac18d1eb799d87a45b3ee0defce) +++ ql/src/test/results/clientpositive/escape_comments.q.out (revision ) @@ -11,13 +11,13 @@ POSTHOOK: type: SWITCHDATABASE POSTHOOK: Input: database:escape_comments_db PREHOOK: query: create table escape_comments_tbl1 -(col1 string comment 'a\nb\'\;') comment 'a\nb' +(col1 string comment 'a\nb\t\'\;') comment 'a\nb' partitioned by (p1 string comment 'a\nb') PREHOOK: type: CREATETABLE PREHOOK: Output: database:escape_comments_db PREHOOK: Output: escape_comments_db@escape_comments_tbl1 POSTHOOK: query: create table escape_comments_tbl1 -(col1 string comment 'a\nb\'\;') comment 'a\nb' +(col1 string comment 'a\nb\t\'\;') comment 'a\nb' partitioned by (p1 string comment 'a\nb') POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:escape_comments_db @@ -35,7 +35,7 @@ POSTHOOK: Output: database:escape_comments_db POSTHOOK: Output: escape_comments_db@escape_comments_view1 POSTHOOK: Lineage: escape_comments_view1.col1 SIMPLE [(escape_comments_tbl1)escape_comments_tbl1.FieldSchema(name:col1, type:string, comment:a -b';), ] +b ';), ] PREHOOK: query: describe database extended escape_comments_db PREHOOK: type: DESCDATABASE PREHOOK: Input: database:escape_comments_db @@ -57,7 +57,7 @@ POSTHOOK: type: SHOW_CREATETABLE POSTHOOK: Input: escape_comments_db@escape_comments_tbl1 CREATE TABLE `escape_comments_tbl1`( - `col1` string COMMENT 'a\nb\'\;') + `col1` string COMMENT 'a\nb\t\'\;') COMMENT 'a\nb' PARTITIONED BY ( `p1` string COMMENT 'a\nb') @@ -79,7 +79,7 @@ POSTHOOK: Input: escape_comments_db@escape_comments_tbl1 # col_name data_type comment col1 string a - b'; + b\t\'\; # Partition Information # col_name data_type comment @@ -120,7 +120,7 @@ POSTHOOK: type: DESCTABLE POSTHOOK: Input: escape_comments_db@escape_comments_tbl1 col1 string a - b'; + b\t\'\; p1 string a b Index: ql/src/test/queries/clientpositive/escape_comments.q IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- ql/src/test/queries/clientpositive/escape_comments.q (revision 1a3090f858ce3ac18d1eb799d87a45b3ee0defce) +++ ql/src/test/queries/clientpositive/escape_comments.q (revision ) @@ -1,7 +1,7 @@ create database escape_comments_db comment 'a\nb'; use escape_comments_db; create table escape_comments_tbl1 -(col1 string comment 'a\nb\'\;') comment 'a\nb' +(col1 string comment 'a\nb\t\'\;') comment 'a\nb' partitioned by (p1 string comment 'a\nb'); create view escape_comments_view1 (col1 comment 'a\nb') comment 'a\nb' as select col1 from escape_comments_tbl1; Index: ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataFormatUtils.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataFormatUtils.java (revision 1a3090f858ce3ac18d1eb799d87a45b3ee0defce) +++ ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataFormatUtils.java (revision ) @@ -404,7 +404,7 @@ } static String getComment(FieldSchema col) { - return col.getComment() != null ? col.getComment() : ""; + return col.getComment() != null ? HiveStringUtils.escapeHiveCommand(col.getComment()) : ""; } /**