You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by wangyum <gi...@git.apache.org> on 2018/06/30 19:17:28 UTC

[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

GitHub user wangyum opened a pull request:

    https://github.com/apache/spark/pull/21682

    [SPARK-24706][SQL] ByteType and ShortType support pushdown to parquet

    ## What changes were proposed in this pull request?
    
    `ByteType` and `ShortType` support pushdown to parquet data source.
    
    ## How was this patch tested?
    
    unit tests


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/wangyum/spark SPARK-24706

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/21682.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #21682
    
----
commit e9d56252e6c65f5afa207bc98c8c5e008de57e0c
Author: Yuming Wang <yu...@...>
Date:   2018-06-30T19:13:13Z

    ByteType and ShortType pushdown to parquet

----


---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by wangyum <gi...@git.apache.org>.
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-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by wangyum <gi...@git.apache.org>.
Github user wangyum commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21682#discussion_r199992294
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFilters.scala ---
    @@ -42,6 +42,10 @@ 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 | ShortType =>
    +      (n: String, v: Any) => FilterApi.eq(
    +        intColumn(n),
    +        Option(v).map(_.asInstanceOf[Number].intValue.asInstanceOf[Integer]).orNull)
    --- End diff --
    
    value may be `null`.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    re: https://github.com/apache/spark/pull/21682#issuecomment-401676889 - I couldn't recall related things about it. Thanks @gatorsmile. So, is it a regression? shall we update the migration guide to note that the performance effect?


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution-unified/603/
    Test PASSed.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution-unified/654/
    Test PASSed.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/92503/
    Test FAILed.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by rdblue <gi...@git.apache.org>.
Github user rdblue commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    +1
    
    I agree with some of the minor refactoring suggestions, but overall this looks correct to me.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution-unified/612/
    Test PASSed.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    **[Test build #92503 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/92503/testReport)** for PR 21682 at commit [`e9d5625`](https://github.com/apache/spark/commit/e9d56252e6c65f5afa207bc98c8c5e008de57e0c).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by rdblue <gi...@git.apache.org>.
Github user rdblue commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21682#discussion_r199977420
  
    --- 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 --
    
    I agree.
    
    Also, there's no need to use `Option.map` because the value cannot be null. That's why the `IntegerType` case just casts the value.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/92589/
    Test PASSed.


---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21682#discussion_r199430250
  
    --- 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 --
    
    Can we actually fold the cases into like:
    
    ```
    case ByteType | ShortType | IntegerType =>
      ... b.asInstanceOf[Number].intValue()
    ```
    
    ?


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/92781/
    Test PASSed.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    thanks, merging to master!


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/92519/
    Test PASSed.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    **[Test build #92503 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/92503/testReport)** for PR 21682 at commit [`e9d5625`](https://github.com/apache/spark/commit/e9d56252e6c65f5afa207bc98c8c5e008de57e0c).


---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by wangyum <gi...@git.apache.org>.
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-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by gengliangwang <gi...@git.apache.org>.
Github user gengliangwang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21682#discussion_r199426772
  
    --- 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 =>
    +      (n: String, v: Any) => FilterApi.eq(
    +        intColumn(n),
    +        Option(v).map(b => b.asInstanceOf[java.lang.Short].toInt.asInstanceOf[Integer]).orNull)
    --- End diff --
    
    I think we can use `Short` instead of `java.lang.Short` here.
    



---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/21682


---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by rdblue <gi...@git.apache.org>.
Github user rdblue commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21682#discussion_r199977784
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFilters.scala ---
    @@ -69,6 +77,14 @@ private[parquet] class ParquetFilters(pushDownDate: Boolean, pushDownStartWith:
       private val makeNotEq: PartialFunction[DataType, (String, Any) => FilterPredicate] = {
         case BooleanType =>
           (n: String, v: Any) => FilterApi.notEq(booleanColumn(n), v.asInstanceOf[java.lang.Boolean])
    +    case ByteType =>
    --- End diff --
    
    Usually, both byte and short would be stored as integers in Parquet. Because Parquet uses bit packing, it doesn't matter if you store them as ints (or even longs) because they'll get packed into the same space.
    
    The important thing is to match the Parquet file's type when pushing a filter. Since Spark stores ByteType and ShortType in Parquet as INT32, this is correct.


---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by gengliangwang <gi...@git.apache.org>.
Github user gengliangwang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21682#discussion_r199426645
  
    --- 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 --
    
    I think we can use `Byte` instead of `java.lang.Byte` here.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    @maropu We accidentally dropped the pushdown of these data types when we refactored the file formats. You can check the change history and find the PR. 


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    **[Test build #92519 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/92519/testReport)** for PR 21682 at commit [`e9d5625`](https://github.com/apache/spark/commit/e9d56252e6c65f5afa207bc98c8c5e008de57e0c).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution-unified/797/
    Test PASSed.


---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by wangyum <gi...@git.apache.org>.
Github user wangyum commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21682#discussion_r199992316
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFilters.scala ---
    @@ -93,6 +101,10 @@ private[parquet] class ParquetFilters(pushDownDate: Boolean, pushDownStartWith:
       }
     
       private val makeLt: PartialFunction[DataType, (String, Any) => FilterPredicate] = {
    +    case ByteType | ShortType =>
    +      (n: String, v: Any) => FilterApi.lt(
    +        intColumn(n),
    +        v.asInstanceOf[Number].intValue.asInstanceOf[Integer])
    --- End diff --
    
    value cannot be `null`.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    **[Test build #92781 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/92781/testReport)** for PR 21682 at commit [`3e66530`](https://github.com/apache/spark/commit/3e6653022a1e2ba9b60142f67ad79c791ee82c24).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21682#discussion_r199400031
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFilters.scala ---
    @@ -69,6 +77,14 @@ private[parquet] class ParquetFilters(pushDownDate: Boolean, pushDownStartWith:
       private val makeNotEq: PartialFunction[DataType, (String, Any) => FilterPredicate] = {
         case BooleanType =>
           (n: String, v: Any) => FilterApi.notEq(booleanColumn(n), v.asInstanceOf[java.lang.Boolean])
    +    case ByteType =>
    --- End diff --
    
    Just for doubly sure, is it an official way to handle short and byte? Can you double check and leave the description API specification @wangyum? Parquet one is pretty core and we should better be clear on this. @rdblue too.


---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by wangyum <gi...@git.apache.org>.
Github user wangyum commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21682#discussion_r201218336
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFilters.scala ---
    @@ -60,8 +62,10 @@ private[parquet] class ParquetFilters(pushDownDate: Boolean, pushDownStartWith:
       private val makeEq: PartialFunction[ParquetSchemaType, (String, Any) => FilterPredicate] = {
         case ParquetBooleanType =>
           (n: String, v: Any) => FilterApi.eq(booleanColumn(n), v.asInstanceOf[java.lang.Boolean])
    -    case ParquetIntegerType =>
    -      (n: String, v: Any) => FilterApi.eq(intColumn(n), v.asInstanceOf[Integer])
    +    case ParquetByteType | ParquetShortType | ParquetIntegerType =>
    +      (n: String, v: Any) => FilterApi.eq(
    +        intColumn(n),
    +        Option(v).map(_.asInstanceOf[Number].intValue.asInstanceOf[Integer]).orNull)
    --- End diff --
    
    `makeEq` and `makeNotEq` may be null: https://github.com/apache/spark/blob/021145f36432b386cce30450c888a85393d5169f/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFilters.scala#L241-L242


---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21682#discussion_r201217859
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFilters.scala ---
    @@ -60,8 +62,10 @@ private[parquet] class ParquetFilters(pushDownDate: Boolean, pushDownStartWith:
       private val makeEq: PartialFunction[ParquetSchemaType, (String, Any) => FilterPredicate] = {
         case ParquetBooleanType =>
           (n: String, v: Any) => FilterApi.eq(booleanColumn(n), v.asInstanceOf[java.lang.Boolean])
    -    case ParquetIntegerType =>
    -      (n: String, v: Any) => FilterApi.eq(intColumn(n), v.asInstanceOf[Integer])
    +    case ParquetByteType | ParquetShortType | ParquetIntegerType =>
    +      (n: String, v: Any) => FilterApi.eq(
    +        intColumn(n),
    +        Option(v).map(_.asInstanceOf[Number].intValue.asInstanceOf[Integer]).orNull)
    --- End diff --
    
    when `v` can be null?


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    cc @gengliangwang 


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    It is a regression that was introduced in Spark 1.2. Almost 4 years ago. https://issues.apache.org/jira/browse/SPARK-4453 
    
    Thus, I think no need to document it. The pushdown can be treated as new features. : )


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    **[Test build #92589 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/92589/testReport)** for PR 21682 at commit [`b16a607`](https://github.com/apache/spark/commit/b16a6076b55bd2e1f01ed66ea7f53d2f915888be).


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by kiszk <gi...@git.apache.org>.
Github user kiszk commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    retest this please


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Merged build finished. Test FAILed.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    **[Test build #92519 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/92519/testReport)** for PR 21682 at commit [`e9d5625`](https://github.com/apache/spark/commit/e9d56252e6c65f5afa207bc98c8c5e008de57e0c).


---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21682#discussion_r199390298
  
    --- 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 =>
    --- End diff --
    
    Let us update the comment in the line 34. 
    ```
    Note: For now timestamp SQL type is not supported for pushing down, because the corresponding
          Parquet type can be Long or INT96. There is no context about Parquet type here.
    ``` 


---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21682#discussion_r199396025
  
    --- 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 =>
    --- End diff --
    
    Probably `INT64 or INT96` (which is long vs binary) might be a bit better while we are here.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by maropu <gi...@git.apache.org>.
Github user maropu commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    @HyukjinKwon btw, why we don't support pushdown for these types? Any historical reason?


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    **[Test build #92589 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/92589/testReport)** for PR 21682 at commit [`b16a607`](https://github.com/apache/spark/commit/b16a6076b55bd2e1f01ed66ea7f53d2f915888be).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    ping @wangyum 


---

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


[GitHub] spark pull request #21682: [SPARK-24706][SQL] ByteType and ShortType support...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21682#discussion_r201218002
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFilters.scala ---
    @@ -60,8 +62,10 @@ private[parquet] class ParquetFilters(pushDownDate: Boolean, pushDownStartWith:
       private val makeEq: PartialFunction[ParquetSchemaType, (String, Any) => FilterPredicate] = {
         case ParquetBooleanType =>
           (n: String, v: Any) => FilterApi.eq(booleanColumn(n), v.asInstanceOf[java.lang.Boolean])
    -    case ParquetIntegerType =>
    -      (n: String, v: Any) => FilterApi.eq(intColumn(n), v.asInstanceOf[Integer])
    +    case ParquetByteType | ParquetShortType | ParquetIntegerType =>
    --- End diff --
    
    since we have a way to distinguish byte/short/int with parquet physical type, let's just write a case for each of them, and cast to the corrected type directly.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    Wow .. so it was 4 years ago .. okay.


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    **[Test build #92781 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/92781/testReport)** for PR 21682 at commit [`3e66530`](https://github.com/apache/spark/commit/3e6653022a1e2ba9b60142f67ad79c791ee82c24).


---

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


[GitHub] spark issue #21682: [SPARK-24706][SQL] ByteType and ShortType support pushdo...

Posted by maropu <gi...@git.apache.org>.
Github user maropu commented on the issue:

    https://github.com/apache/spark/pull/21682
  
    @gatorsmile aha, thanks.


---

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