cloud-fan commented on a change in pull request #31281:
URL: https://github.com/apache/spark/pull/31281#discussion_r563530341
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
##########
@@ -988,7 +989,15 @@ private[hive] class HiveClientImpl(
private[hive] object HiveClientImpl extends Logging {
/** Converts the native StructField to Hive's FieldSchema. */
def toHiveColumn(c: StructField): FieldSchema = {
- val typeString = HiveVoidType.replaceVoidType(c.dataType).catalogString
+ val typeString = if
(c.metadata.contains(CHAR_VARCHAR_TYPE_STRING_METADATA_KEY)) {
+ // For Hive Serde, we still need to to restore the raw type for char and
varchar type.
+ // 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.
+ c.metadata.getString(CHAR_VARCHAR_TYPE_STRING_METADATA_KEY)
Review comment:
we can add a `getRawTypeString` in `CharVarcharUtils`, instead of
exposing `CHAR_VARCHAR_TYPE_STRING_METADATA_KEY`?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]