Skip to content

Commit fa2e0cc

Browse files
committed
Only create hive type metadata entry when we have to.
1 parent e832ce6 commit fa2e0cc

File tree

1 file changed

+5
-2
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser

1 file changed

+5
-2
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,11 +1490,14 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] with Logging {
14901490
}
14911491
// Add Hive type string to metadata.
14921492
val rawDataType = typedVisit[DataType](ctx.dataType)
1493-
builder.putString(HIVE_TYPE_STRING, rawDataType.catalogString)
1493+
val cleanedDataType = HiveStringType.replaceCharType(rawDataType)
1494+
if (rawDataType != cleanedDataType) {
1495+
builder.putString(HIVE_TYPE_STRING, rawDataType.catalogString)
1496+
}
14941497

14951498
StructField(
14961499
identifier.getText,
1497-
HiveStringType.replaceCharType(rawDataType),
1500+
cleanedDataType,
14981501
nullable = true,
14991502
builder.build())
15001503
}

0 commit comments

Comments
 (0)