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

    https://github.com/apache/spark/pull/21682#discussion_r199991024
  
    --- 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)
    +    case ShortType =>
    --- End diff --
    
    How about like this:
    
    - `makeEq` and `makeNotEq`
    ```scala
        case ByteType | ShortType =>
          (n: String, v: Any) => FilterApi.notEq(
            intColumn(n),
            
Option(v).map(_.asInstanceOf[Number].intValue.asInstanceOf[Integer]).orNull)
        case IntegerType =>
          (n: String, v: Any) => FilterApi.notEq(intColumn(n), 
v.asInstanceOf[Integer])
    ```
     - `makeLt`, `makeLtEq`, `makeGt` and `makeGtEq`:
    ```scala
        case ByteType | ShortType =>
          (n: String, v: Any) => FilterApi.gtEq(
            intColumn(n),
            v.asInstanceOf[Number].intValue.asInstanceOf[Integer])
        case IntegerType =>
          (n: String, v: Any) => FilterApi.gtEq(intColumn(n), 
v.asInstanceOf[java.lang.Integer])
    ```


---

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

Reply via email to