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

    https://github.com/apache/spark/pull/14363#discussion_r72694426
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala 
---
    @@ -721,16 +723,16 @@ private[hive] class HiveClientImpl(
         Utils.classForName(name)
           .asInstanceOf[Class[_ <: 
org.apache.hadoop.hive.ql.io.HiveOutputFormat[_, _]]]
     
    -  private def toHiveColumn(c: CatalogColumn): FieldSchema = {
    -    new FieldSchema(c.name, c.dataType, c.comment.orNull)
    +  private def toHiveColumn(c: StructField): FieldSchema = {
    +    new FieldSchema(c.name, c.dataType.catalogString, 
c.getComment().orNull)
       }
     
    -  private def fromHiveColumn(hc: FieldSchema): CatalogColumn = {
    -    new CatalogColumn(
    +  private def fromHiveColumn(hc: FieldSchema): StructField = {
    +    val f = StructField(
           name = hc.getName,
    -      dataType = hc.getType,
    -      nullable = true,
    -      comment = Option(hc.getComment))
    +      dataType = CatalystSqlParser.parseDataType(hc.getType),
    --- End diff --
    
    This is the change we have to make if we convert `CatalogColumn` to 
`StructField`. It sounds like `hc.getType` could return null? or Hive could 
return some data types we might not recognize. We could hit the exception from 
Parser, right?
    
    That means, the caller of `fromHiveColumn` will also get the exception. 
`getTableOption` is the caller. I am just wondering if we do not want to see 
this kind of exception when doing `getTableOption`. Or maybe issue a nicer 
error message here?


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