You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ec...@apache.org on 2013/07/27 17:01:03 UTC
svn commit: r1507656 - in /hive/trunk/ql/src:
java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataFormatter.java
test/queries/clientpositive/describe_comment_nonascii.q
test/results/clientpositive/describe_comment_nonascii.q.out
Author: ecapriolo
Date: Sat Jul 27 15:01:03 2013
New Revision: 1507656
URL: http://svn.apache.org/r1507656
Log:
HIVE-2905 Desc table can not show non-ascii comments (Xiaozhe Wang and Navis Ryu via egc)
Submitted by: Xiaozhe Wang and Navis Ryu
Reviewed by: Edward Capriolo
Added:
hive/trunk/ql/src/test/queries/clientpositive/describe_comment_nonascii.q
hive/trunk/ql/src/test/results/clientpositive/describe_comment_nonascii.q.out
Modified:
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataFormatter.java
Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataFormatter.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataFormatter.java?rev=1507656&r1=1507655&r2=1507656&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataFormatter.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/TextMetaDataFormatter.java Sat Jul 27 15:01:03 2013
@@ -119,27 +119,27 @@ class TextMetaDataFormatter implements M
boolean isFormatted, boolean isExt, boolean isPretty)
throws HiveException {
try {
+ String output;
if (colPath.equals(tableName)) {
List<FieldSchema> partCols = tbl.isPartitioned() ? tbl.getPartCols() : null;
- outStream.writeBytes(
- isPretty ?
- MetaDataPrettyFormatUtils.getAllColumnsInformation(
- cols, partCols, prettyOutputNumCols)
+ output = isPretty ?
+ MetaDataPrettyFormatUtils.getAllColumnsInformation(
+ cols, partCols, prettyOutputNumCols)
:
- MetaDataFormatUtils.getAllColumnsInformation(cols, partCols, isFormatted)
- );
+ MetaDataFormatUtils.getAllColumnsInformation(cols, partCols, isFormatted);
} else {
- outStream.writeBytes(
- MetaDataFormatUtils.getAllColumnsInformation(cols, isFormatted));
+ output = MetaDataFormatUtils.getAllColumnsInformation(cols, isFormatted);
}
+ outStream.write(output.getBytes());
if (tableName.equals(colPath)) {
if (isFormatted) {
if (part != null) {
- outStream.writeBytes(MetaDataFormatUtils.getPartitionInformation(part));
+ output = MetaDataFormatUtils.getPartitionInformation(part);
} else {
- outStream.writeBytes(MetaDataFormatUtils.getTableInformation(tbl));
+ output = MetaDataFormatUtils.getTableInformation(tbl);
}
+ outStream.write(output.getBytes());
}
// if extended desc table then show the complete details of the table
@@ -150,7 +150,7 @@ class TextMetaDataFormatter implements M
// show partition information
outStream.writeBytes("Detailed Partition Information");
outStream.write(separator);
- outStream.writeBytes(part.getTPartition().toString());
+ outStream.write(part.getTPartition().toString().getBytes());
outStream.write(separator);
// comment column is empty
outStream.write(terminator);
@@ -158,7 +158,7 @@ class TextMetaDataFormatter implements M
// show table information
outStream.writeBytes("Detailed Table Information");
outStream.write(separator);
- outStream.writeBytes(tbl.getTTable().toString());
+ outStream.write(tbl.getTTable().toString().getBytes());
outStream.write(separator);
outStream.write(terminator);
}
@@ -444,7 +444,7 @@ class TextMetaDataFormatter implements M
outStream.writeBytes(database);
outStream.write(separator);
if (comment != null) {
- outStream.writeBytes(comment);
+ outStream.write(comment.getBytes());
}
outStream.write(separator);
if (location != null) {
Added: hive/trunk/ql/src/test/queries/clientpositive/describe_comment_nonascii.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/describe_comment_nonascii.q?rev=1507656&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/describe_comment_nonascii.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/describe_comment_nonascii.q Sat Jul 27 15:01:03 2013
@@ -0,0 +1,9 @@
+-- HIVE-2905 showing non-ascii comments
+
+create table dummy (col1 string, col2 string, col3 string);
+
+alter table dummy change col1 col1 string comment 'íê¸_col1';
+alter table dummy change col2 col2 string comment 'æ¼¢å_col2';
+alter table dummy change col3 col3 string comment 'ãã_col3';
+
+DESCRIBE FORMATTED dummy;
Added: hive/trunk/ql/src/test/results/clientpositive/describe_comment_nonascii.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/describe_comment_nonascii.q.out?rev=1507656&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/describe_comment_nonascii.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/describe_comment_nonascii.q.out Sat Jul 27 15:01:03 2013
@@ -0,0 +1,63 @@
+PREHOOK: query: -- HIVE-2905 showing non-ascii comments
+
+create table dummy (col1 string, col2 string, col3 string)
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: -- HIVE-2905 showing non-ascii comments
+
+create table dummy (col1 string, col2 string, col3 string)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@dummy
+PREHOOK: query: alter table dummy change col1 col1 string comment 'íê¸_col1'
+PREHOOK: type: ALTERTABLE_RENAMECOL
+PREHOOK: Input: default@dummy
+PREHOOK: Output: default@dummy
+POSTHOOK: query: alter table dummy change col1 col1 string comment 'íê¸_col1'
+POSTHOOK: type: ALTERTABLE_RENAMECOL
+POSTHOOK: Input: default@dummy
+POSTHOOK: Output: default@dummy
+PREHOOK: query: alter table dummy change col2 col2 string comment 'æ¼¢å_col2'
+PREHOOK: type: ALTERTABLE_RENAMECOL
+PREHOOK: Input: default@dummy
+PREHOOK: Output: default@dummy
+POSTHOOK: query: alter table dummy change col2 col2 string comment 'æ¼¢å_col2'
+POSTHOOK: type: ALTERTABLE_RENAMECOL
+POSTHOOK: Input: default@dummy
+POSTHOOK: Output: default@dummy
+PREHOOK: query: alter table dummy change col3 col3 string comment 'ãã_col3'
+PREHOOK: type: ALTERTABLE_RENAMECOL
+PREHOOK: Input: default@dummy
+PREHOOK: Output: default@dummy
+POSTHOOK: query: alter table dummy change col3 col3 string comment 'ãã_col3'
+POSTHOOK: type: ALTERTABLE_RENAMECOL
+POSTHOOK: Input: default@dummy
+POSTHOOK: Output: default@dummy
+PREHOOK: query: DESCRIBE FORMATTED dummy
+PREHOOK: type: DESCTABLE
+POSTHOOK: query: DESCRIBE FORMATTED dummy
+POSTHOOK: type: DESCTABLE
+# col_name data_type comment
+
+col1 string íê¸_col1
+col2 string æ¼¢å_col2
+col3 string ãã_col3
+
+# Detailed Table Information
+Database: default
+#### A masked pattern was here ####
+Protect Mode: None
+Retention: 0
+#### A masked pattern was here ####
+Table Type: MANAGED_TABLE
+Table Parameters:
+#### A masked pattern was here ####
+
+# Storage Information
+SerDe Library: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+InputFormat: org.apache.hadoop.mapred.TextInputFormat
+OutputFormat: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+Compressed: No
+Num Buckets: -1
+Bucket Columns: []
+Sort Columns: []
+Storage Desc Params:
+ serialization.format 1