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

    https://github.com/apache/spark/pull/3114#discussion_r20035049
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala ---
    @@ -254,46 +255,59 @@ private[hive] trait HiveInspectors {
       }
     
       def toInspector(expr: Expression): ObjectInspector = expr match {
    -    case Literal(value: String, StringType) =>
    -      HiveShim.getPrimitiveWritableConstantObjectInspector(value)
    -    case Literal(value: Int, IntegerType) =>
    -      HiveShim.getPrimitiveWritableConstantObjectInspector(value)
    -    case Literal(value: Double, DoubleType) =>
    -      HiveShim.getPrimitiveWritableConstantObjectInspector(value)
    -    case Literal(value: Boolean, BooleanType) =>
    -      HiveShim.getPrimitiveWritableConstantObjectInspector(value)
    -    case Literal(value: Long, LongType) =>
    -      HiveShim.getPrimitiveWritableConstantObjectInspector(value)
    -    case Literal(value: Float, FloatType) =>
    -      HiveShim.getPrimitiveWritableConstantObjectInspector(value)
    -    case Literal(value: Short, ShortType) =>
    -      HiveShim.getPrimitiveWritableConstantObjectInspector(value)
    -    case Literal(value: Byte, ByteType) =>
    -      HiveShim.getPrimitiveWritableConstantObjectInspector(value)
    -    case Literal(value: Array[Byte], BinaryType) =>
    -      HiveShim.getPrimitiveWritableConstantObjectInspector(value)
    -    case Literal(value: java.sql.Date, DateType) =>
    -      HiveShim.getPrimitiveWritableConstantObjectInspector(value)
    -    case Literal(value: java.sql.Timestamp, TimestampType) =>
    -      HiveShim.getPrimitiveWritableConstantObjectInspector(value)
    -    case Literal(value: BigDecimal, DecimalType()) =>
    -      HiveShim.getPrimitiveWritableConstantObjectInspector(value)
    -    case Literal(value: Decimal, DecimalType()) =>
    -      
HiveShim.getPrimitiveWritableConstantObjectInspector(value.toBigDecimal)
    +    case Literal(value, StringType) =>
    +      
HiveShim.getPrimitiveWritableConstantObjectInspector(value.asInstanceOf[String])
    +    case Literal(value, IntegerType) =>
    +      
HiveShim.getPrimitiveWritableConstantObjectInspector(value.asInstanceOf[Int])
    +    case Literal(value, DoubleType) =>
    +      
HiveShim.getPrimitiveWritableConstantObjectInspector(value.asInstanceOf[Double])
    +    case Literal(value, BooleanType) =>
    +      
HiveShim.getPrimitiveWritableConstantObjectInspector(value.asInstanceOf[Boolean])
    +    case Literal(value, LongType) =>
    +      
HiveShim.getPrimitiveWritableConstantObjectInspector(value.asInstanceOf[Long])
    +    case Literal(value, FloatType) =>
    +      
HiveShim.getPrimitiveWritableConstantObjectInspector(value.asInstanceOf[Float])
    +    case Literal(value, ShortType) =>
    +      
HiveShim.getPrimitiveWritableConstantObjectInspector(value.asInstanceOf[Short])
    --- End diff --
    
    Why the cast here?  This destroys null values:
    
    ```scala
    scala> null.asInstanceOf[Short]
    res0: Short = 0
    ```


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