yaooqinn commented on code in PR #48986:
URL: https://github.com/apache/spark/pull/48986#discussion_r1863011242
##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala:
##########
@@ -1092,13 +1090,33 @@ private[hive] object HiveClientImpl extends Logging {
// When reading data in parquet, orc, or avro file format with string type
for char,
// the tailing spaces may lost if we are not going to pad it.
val typeString = if (SQLConf.get.charVarcharAsString) {
- c.dataType.catalogString
+ catalogString(c.dataType)
} else {
-
CharVarcharUtils.getRawTypeString(c.metadata).getOrElse(c.dataType.catalogString)
+
CharVarcharUtils.getRawTypeString(c.metadata).getOrElse(catalogString(c.dataType))
}
new FieldSchema(c.name, typeString, c.getComment().orNull)
}
+ def catalogString(dataType: DataType): String = dataType match {
Review Comment:
Below are the test failures with output changes
https://github.com/yaooqinn/spark/actions/runs/12048451922/job/33593132614
https://github.com/yaooqinn/spark/actions/runs/12048451922/job/33593135297
##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala:
##########
@@ -1111,7 +1129,12 @@ private[hive] object HiveClientImpl extends Logging {
// struct<x:int,y.z:int> -> struct<`x`:int,`y.z`:int>
// array<struct<x:int,y.z:int>> -> array<struct<`x`:int,`y.z`:int>>
// map<string,struct<x:int,y.z:int>> ->
map<string,struct<`x`:int,`y.z`:int>>
- val typeStr = hc.getType.replaceAll("(?<=struct<|,)([^,<:]+)(?=:)", "`$1`")
+ val typeStr = if (SQLConf.get.getConf(QUOTE_HIVE_STRUCT_FIELD_NAME) &&
+ hc.getType.indexOf('`') < 0) {
Review Comment:
Sure
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]