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

    https://github.com/apache/spark/pull/5078#discussion_r26630264
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala ---
    @@ -779,7 +779,39 @@ private[hive] case class MetastoreRelation
     
     
     private[hive] object HiveMetastoreTypes {
    -  protected val ddlParser = new DDLParser(HiveQl.parseSql(_))
    +  private[hive] val ddlParser = new DDLParser(HiveQl.parseSql(_)) {
    +    // If a struct field use any of our reserved keyword, the field name 
return by
    +    // Hive through FieldSchema.getType will not be quoted by backticks.
    +    // we need to override structField to handle this kind of cases.
    +    override protected lazy val structField: Parser[StructField] =
    +      (ident ~ ":" ~ dataType ^^ {
    +        case fieldName ~ _ ~ tpe => StructField(fieldName, tpe, nullable = 
true)
    +      }) |
    +      (keywords ~ ":" ~ dataType ^^ {
    +        case fieldName ~ _ ~ tpe => {
    +          StructField(fieldName, tpe, nullable = true)
    +        }
    +      })
    --- End diff --
    
    This seems kind of hacky to me.  Is there a reason we can't just use a the 
regex parser for types always?  I guess I'm not sure if you can mix parser 
types like that.


---
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