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

    https://github.com/apache/spark/pull/3429#discussion_r22027845
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala ---
    @@ -119,12 +271,44 @@ private[hive] trait HiveInspectors {
           System.arraycopy(writable.getBytes, 0, temp, 0, temp.length)
           temp
         case poi: WritableConstantDateObjectInspector => 
poi.getWritableConstantValue.get()
    -    case hvoi: HiveVarcharObjectInspector => 
hvoi.getPrimitiveJavaObject(data).getValue
    -    case hdoi: HiveDecimalObjectInspector => 
HiveShim.toCatalystDecimal(hdoi, data)
    -    // org.apache.hadoop.hive.serde2.io.TimestampWritable.set will reset 
current time object
    -    // if next timestamp is null, so Timestamp object is cloned
    -    case ti: TimestampObjectInspector => 
ti.getPrimitiveJavaObject(data).clone()
    -    case pi: PrimitiveObjectInspector => pi.getPrimitiveJavaObject(data)
    +    case mi: StandardConstantMapObjectInspector =>
    +      // take the value from the map inspector object, rather than the 
input data
    +      mi.getWritableConstantValue.map { case (k, v) =>
    +        (unwrap(k, mi.getMapKeyObjectInspector),
    +          unwrap(v, mi.getMapValueObjectInspector))
    +      }.toMap
    +    case li: StandardConstantListObjectInspector =>
    +      // take the value from the list inspector object, rather than the 
input data
    +      li.getWritableConstantValue.map(unwrap(_, 
li.getListElementObjectInspector)).toSeq
    +    // if the value is null, we don't care about the object inspector type
    +    case _ if data == null => null
    +    case poi: VoidObjectInspector => null // always be null for void 
object inspector
    +    case pi: PrimitiveObjectInspector => pi match {
    +      // We think HiveVarchar is also a String
    +      case hvoi: HiveVarcharObjectInspector if hvoi.preferWritable() =>
    +        hvoi.getPrimitiveWritableObject(data).getHiveVarchar.getValue
    +      case hvoi: HiveVarcharObjectInspector => 
hvoi.getPrimitiveJavaObject(data).getValue
    +      case x: StringObjectInspector if x.preferWritable() =>
    +        x.getPrimitiveWritableObject(data).toString
    +      case x: IntObjectInspector if x.preferWritable() => x.get(data)
    +      case x: BooleanObjectInspector if x.preferWritable() =>x.get(data)
    --- End diff --
    
    Space after `=>`


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