Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12271#discussion_r59497215
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveSqlParser.scala 
---
    @@ -435,13 +480,15 @@ class HiveSqlAstBuilder extends SparkSqlAstBuilder {
       /**
        * Create a sequence of [[CatalogColumn]]s from a column list
        */
    -  private def visitCatalogColumns(
    -      ctx: ColTypeListContext,
    -      formatter: String => String = identity): Seq[CatalogColumn] = 
withOrigin(ctx) {
    +  private def visitCatalogColumns(ctx: ColTypeListContext): 
Seq[CatalogColumn] = withOrigin(ctx) {
         ctx.colType.asScala.map { col =>
           CatalogColumn(
    -        formatter(col.identifier.getText),
    -        col.dataType.getText.toLowerCase, // TODO validate this?
    +        col.identifier.getText.toLowerCase,
    +        // Note: for types like "STRUCT<myFirstName: STRING, myLastName: 
STRING>" we can't
    +        // just convert the whole type string to lower case, otherwise the 
struct field names
    +        // will no longer be case sensitive. Instead, we rely on our 
parser to get the proper
    +        // case before passing it to Hive.
    +        HiveMetastoreTypes.toDataType(col.dataType.getText).simpleString,
    --- End diff --
    
    I think we need to use `parseDataType`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to