Repository: hive Updated Branches: refs/heads/master fd3498b33 -> 1fff171c6
HIVE-21095: Show create table should not display a time zone for timestamp with local time zone (Karen Coppage via Marta Kuczora) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/1fff171c Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/1fff171c Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/1fff171c Branch: refs/heads/master Commit: 1fff171c60647ba70d4fa8d7c7d52ca644700803 Parents: fd3498b Author: Karen Coppage <kcopp.apa...@gmail.com> Authored: Wed Jan 16 12:26:51 2019 +0100 Committer: Marta Kuczora <kuczo...@cloudera.com> Committed: Wed Jan 16 12:26:51 2019 +0100 ---------------------------------------------------------------------- .../hadoop/hive/ql/parse/DDLSemanticAnalyzer.java | 10 ++-------- .../clientpositive/llap/default_constraint.q.out | 4 ++-- .../hive/serde2/typeinfo/TimestampLocalTZTypeInfo.java | 12 +++++++----- 3 files changed, 11 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/1fff171c/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java index b477480..0e5b3e5 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java @@ -243,14 +243,8 @@ public class DDLSemanticAnalyzer extends BaseSemanticAnalyzer { typeName = varcharTypeInfo.getQualifiedName(); break; case HiveParser.TOK_TIMESTAMPLOCALTZ: - HiveConf conf; - try { - conf = Hive.get().getConf(); - } catch (HiveException e) { - throw new SemanticException(e); - } - TimestampLocalTZTypeInfo timestampLocalTZTypeInfo = TypeInfoFactory.getTimestampTZTypeInfo( - conf.getLocalTimeZone()); + TimestampLocalTZTypeInfo timestampLocalTZTypeInfo = + TypeInfoFactory.getTimestampTZTypeInfo(null); typeName = timestampLocalTZTypeInfo.getQualifiedName(); break; case HiveParser.TOK_DECIMAL: http://git-wip-us.apache.org/repos/asf/hive/blob/1fff171c/ql/src/test/results/clientpositive/llap/default_constraint.q.out ---------------------------------------------------------------------- diff --git a/ql/src/test/results/clientpositive/llap/default_constraint.q.out b/ql/src/test/results/clientpositive/llap/default_constraint.q.out index 14ec576..5d716eb 100644 --- a/ql/src/test/results/clientpositive/llap/default_constraint.q.out +++ b/ql/src/test/results/clientpositive/llap/default_constraint.q.out @@ -299,7 +299,7 @@ POSTHOOK: Input: default@table1_n16 # col_name data_type comment d date t timestamp -tz timestamp with local time zone('US/Pacific') +tz timestamp with local time zone d1 date t1 timestamp @@ -1082,7 +1082,7 @@ b5 bigint b6 smallint j varchar(50) k string -tz1 timestamp with local time zone('US/Pacific') +tz1 timestamp with local time zone ts timestamp dc decimal(8,2) c2 double http://git-wip-us.apache.org/repos/asf/hive/blob/1fff171c/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TimestampLocalTZTypeInfo.java ---------------------------------------------------------------------- diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TimestampLocalTZTypeInfo.java b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TimestampLocalTZTypeInfo.java index 6f9eeea..a4f3af1 100644 --- a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TimestampLocalTZTypeInfo.java +++ b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TimestampLocalTZTypeInfo.java @@ -73,19 +73,21 @@ public class TimestampLocalTZTypeInfo extends PrimitiveTypeInfo { @Override public String toString() { - return getQualifiedName(); + return getQualifiedName(timeZone); } @Override public String getQualifiedName() { - return getQualifiedName(timeZone); + return getQualifiedName(null); } public static String getQualifiedName(ZoneId timeZone) { StringBuilder sb = new StringBuilder(serdeConstants.TIMESTAMPLOCALTZ_TYPE_NAME); - sb.append("('"); - sb.append(timeZone); - sb.append("')"); + if (timeZone != null) { + sb.append("('"); + sb.append(timeZone); + sb.append("')"); + } return sb.toString(); }