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

    https://github.com/apache/spark/pull/21682#discussion_r199986187
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFilters.scala
 ---
    @@ -42,6 +42,14 @@ private[parquet] class ParquetFilters(pushDownDate: 
Boolean, pushDownStartWith:
       private val makeEq: PartialFunction[DataType, (String, Any) => 
FilterPredicate] = {
         case BooleanType =>
           (n: String, v: Any) => FilterApi.eq(booleanColumn(n), 
v.asInstanceOf[java.lang.Boolean])
    +    case ByteType =>
    +      (n: String, v: Any) => FilterApi.eq(
    +        intColumn(n),
    +        Option(v).map(b => 
b.asInstanceOf[java.lang.Byte].toInt.asInstanceOf[Integer]).orNull)
    --- End diff --
    
    ```scala
    scala> null.asInstanceOf[Short].toInt.asInstanceOf[Integer]
    res49: Integer = 0
    
    scala> null.asInstanceOf[java.lang.Short].toInt.asInstanceOf[Integer]
    java.lang.NullPointerException
      at scala.Predef$.Short2short(Predef.scala:360)
      ... 51 elided
    ```
    That's why I use `Option.map` here.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to