diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java index b477480e0a..b0a8207f12 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java @@ -243,14 +243,7 @@ public static String getTypeName(ASTNode node) throws SemanticException { 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(); typeName = timestampLocalTZTypeInfo.getQualifiedName(); break; case HiveParser.TOK_DECIMAL: diff --git ql/src/test/results/clientpositive/llap/default_constraint.q.out ql/src/test/results/clientpositive/llap/default_constraint.q.out index 14ec576e55..5d716ebb56 100644 --- ql/src/test/results/clientpositive/llap/default_constraint.q.out +++ 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 diff --git serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TimestampLocalTZTypeInfo.java serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TimestampLocalTZTypeInfo.java index 6f9eeea020..a4f3af1112 100644 --- serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TimestampLocalTZTypeInfo.java +++ serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TimestampLocalTZTypeInfo.java @@ -73,19 +73,21 @@ public int hashCode() { @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(); }