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

    https://github.com/apache/spark/pull/16944#discussion_r104251665
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala ---
    @@ -169,16 +179,22 @@ private[hive] class 
HiveMetastoreCatalog(sparkSession: SparkSession) extends Log
                 }
               }
     
    +          val (dataSchema, updatedTable) = inferIfNeeded(
    +            relation,
    +            options,
    +            filteredMetastoreSchema,
    +            fileFormat,
    +            Option(fileIndex))
    +
               val fsRelation = HadoopFsRelation(
                 location = fileIndex,
                 partitionSchema = partitionSchema,
    -            dataSchema = relation.tableMeta.dataSchema,
    +            dataSchema = dataSchema,
                 // We don't support hive bucketed tables, only ones we write 
out.
                 bucketSpec = None,
    -            fileFormat = fileFormatClass.newInstance(),
    +            fileFormat = fileFormat,
                 options = options)(sparkSession = sparkSession)
    -
    -          val created = LogicalRelation(fsRelation, catalogTable = 
Some(relation.tableMeta))
    +          val created = LogicalRelation(fsRelation, catalogTable = 
Option(updatedTable))
    --- End diff --
    
    I don't think I was very clear. Hypothetically, if ```a``` were null when 
it shouldn't be:
    
    1. ```Some(a)``` will result in ```Some(null)```
    2. ```Option(a)``` will result in ```None```
    
    Based on your response, (1) is the preferred approach, meaning a runtime 
error will occur when attempting to use the (expected non-null) value rather 
than just thinking an optional value wasn't provided.


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