You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by sbcd90 <gi...@git.apache.org> on 2016/05/09 19:54:22 UTC

[GitHub] spark pull request: [SPARK-15204][SQL] Nullable is not correct for...

GitHub user sbcd90 opened a pull request:

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

    [SPARK-15204][SQL] Nullable is not correct for Aggregator

    ## What changes were proposed in this pull request?
    
    ```
    object SimpleSum extends Aggregator[Row, Int, Int] {
      def zero: Int = 0
      def reduce(b: Int, a: Row) = b + a.getInt(1)
      def merge(b1: Int, b2: Int) = b1 + b2
      def finish(b: Int) = b
      def bufferEncoder: Encoder[Int] = Encoders.scalaInt
      def outputEncoder: Encoder[Int] = Encoders.scalaInt
    }
    
    val df = List(("a", 1), ("a", 2), ("a", 3)).toDF("k", "v")
    val df1 = df.groupBy("k").agg(SimpleSum.toColumn as "v1")
    df1.printSchema
    df1.show
    
    root
     |-- k: string (nullable = true)
     |-- v1: integer (nullable = true)
    
    +---+---+
    |  k| v1|
    +---+---+
    |  a|  6|
    +---+---+
    ```
    The above example shows `v1` as `nullable=true` which is incorrect.
    The aggregate fields should be non-nullable in the schema.
    
    
    ## How was this patch tested?
    
    unit tests

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

    $ git pull https://github.com/sbcd90/spark aggregatorSchemaIssue

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

    https://github.com/apache/spark/pull/13012.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 #13012
    
----
commit c66d36c3ce956ad7c14ed18c3877bd0c6c257d2d
Author: Subhobrata Dey <sb...@gmail.com>
Date:   2016-05-09T19:39:50Z

    [SPARK-15204][SQL] Nullable is not correct for Aggregator

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15204][SQL] Nullable is not correct for...

Posted by sbcd90 <gi...@git.apache.org>.
Github user sbcd90 commented on the pull request:

    https://github.com/apache/spark/pull/13012#issuecomment-217982471
  
    Jenkins test this please


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15204][SQL] Nullable is not correct for...

Posted by sbcd90 <gi...@git.apache.org>.
Github user sbcd90 commented on the pull request:

    https://github.com/apache/spark/pull/13012#issuecomment-217985550
  
    Jenkins retest this please


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15204][SQL] Nullable is not correct for...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the pull request:

    https://github.com/apache/spark/pull/13012#issuecomment-218055811
  
    That's not the right fix, because the zero value can be non-null, and yet the result can still be null. The right fix probably requires looking at the encoder.



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15204][SQL] Nullable is not correct for...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the pull request:

    https://github.com/apache/spark/pull/13012#issuecomment-218054495
  
    Your last sentence was what I was saying. It is not correct to just have nullable = false.
    
    Please close this pull request as it is not a proper fix.



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15204][SQL] Nullable is not correct for...

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

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


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15204][SQL] Nullable is not correct for...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the pull request:

    https://github.com/apache/spark/pull/13012#issuecomment-218049147
  
    Is this even correct? Certain aggregators might return nulls.



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15204][SQL] Nullable is not correct for...

Posted by koertkuipers <gi...@git.apache.org>.
Github user koertkuipers commented on the pull request:

    https://github.com/apache/spark/pull/13012#issuecomment-218053856
  
    blackbox transformations infer nullable=false when you return a primitive. for example:
    ```
    scala> sc.parallelize(List(1,2,3)).toDS.map(i => i * 2).schema
    res0: org.apache.spark.sql.types.StructType = StructType(StructField(value,IntegerType,false))
    ```
    why would aggregator be any different?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15204][SQL] Nullable is not correct for...

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

    https://github.com/apache/spark/pull/13012#issuecomment-217971392
  
    Can one of the admins verify this patch?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15204][SQL] Nullable is not correct for...

Posted by sbcd90 <gi...@git.apache.org>.
Github user sbcd90 commented on the pull request:

    https://github.com/apache/spark/pull/13012#issuecomment-218054997
  
    Hello @rxin , @koertkuipers ,
    
    I have been following your conversation & feel that the right fix will be
    
    ```
    override def nullable: Boolean = Literal.fromObject(aggregator.zero, bufferExternalType).nullable
    ```
    
    I'm in the process of updating the PR with the changes. Please let me know what do you think about the changes. 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15204][SQL] Nullable is not correct for...

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

    https://github.com/apache/spark/pull/13012#issuecomment-217976256
  
    **[Test build #2978 has finished](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/2978/consoleFull)** for PR 13012 at commit [`c66d36c`](https://github.com/apache/spark/commit/c66d36c3ce956ad7c14ed18c3877bd0c6c257d2d).
     * This patch **fails MiMa tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15204][SQL] Nullable is not correct for...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the pull request:

    https://github.com/apache/spark/pull/13012#issuecomment-218055835
  
    @sbcd90 please just close this until you figure out the right fix.



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15204][SQL] Nullable is not correct for...

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

    https://github.com/apache/spark/pull/13012#issuecomment-217973100
  
    **[Test build #2978 has started](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/2978/consoleFull)** for PR 13012 at commit [`c66d36c`](https://github.com/apache/spark/commit/c66d36c3ce956ad7c14ed18c3877bd0c6c257d2d).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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