Github user chenghao-intel commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4289#discussion_r24290001
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/TableReader.scala ---
    @@ -315,9 +335,17 @@ private[hive] object HadoopTableReader extends 
HiveInspectors {
           }
         }
     
    +    /**
    +     * when the soi and deserializer.getObjectInspector is equal,
    +     * we will get `IdentityConverter`,which mean it won't convert the
    +     * value when schema match
    +     */
    +    val partTblObjectInspectorConverter = 
ObjectInspectorConverters.getConverter(
    +      deserializer.getObjectInspector, soi)
    +
         // Map each tuple to a row object
         iterator.map { value =>
    -      val raw = deserializer.deserialize(value)
    +      val raw = 
partTblObjectInspectorConverter.convert(deserializer.deserialize(value))
    --- End diff --
    
    @jeanlyn Thank you for the explanation offline, after reading the source 
code of Hive `ObjectInspector Converter`, I realize the `Converter` only 
support the `SettableObjectInspector`, that's why we need the `ConvertedOI` 
also.
    
    I've also tested your code by adding some of my thought at 
https://github.com/chenghao-intel/spark/commit/955cd38cab53c9db8bbba3b9ea84a326cc86ac43
    
    Feel free to take it's helpful. :)


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