You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by yhuai <gi...@git.apache.org> on 2015/11/01 01:03:08 UTC

[GitHub] spark pull request: [SPARK-11438] [SQL] Allow users to define nond...

GitHub user yhuai opened a pull request:

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

    [SPARK-11438] [SQL] Allow users to define nondeterministic udfs.

    https://issues.apache.org/jira/browse/SPARK-11438

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

    $ git pull https://github.com/yhuai/spark udfNondeterministic

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

    https://github.com/apache/spark/pull/9393.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 #9393
    
----
commit 1fb28e4d4421fc81dd05d2a0f2e83ce96fad596b
Author: Yin Huai <yh...@databricks.com>
Date:   2015-11-01T00:00:16Z

    Allow users to define nondeterministic udfs.

----


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152784648
  
    **[Test build #44743 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44743/consoleFull)** for PR 9393 at commit [`f7a476c`](https://github.com/apache/spark/commit/f7a476c4fea01a9546ee5b83cb77503ca1e7df00).


---
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-11469] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153239847
  
    **[Test build #44865 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44865/consoleFull)** for PR 9393 at commit [`d2ee5ee`](https://github.com/apache/spark/commit/d2ee5eee7c569b551779a2d73a98c84fd335a4ac).
     * This patch passes all 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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152793027
  
     Merged build triggered.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#discussion_r43674351
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala ---
    @@ -30,13 +30,18 @@ case class ScalaUDF(
         function: AnyRef,
         dataType: DataType,
         children: Seq[Expression],
    -    inputTypes: Seq[DataType] = Nil)
    +    inputTypes: Seq[DataType] = Nil,
    +    isDeterministic: Boolean = true)
       extends Expression with ImplicitCastInputTypes with CodegenFallback {
     
       override def nullable: Boolean = true
     
       override def toString: String = s"UDF(${children.mkString(",")})"
     
    +  override def foldable: Boolean = deterministic && children.forall(_.foldable)
    --- End diff --
    
    I override `foldable` at here. We can later take a look at how we override `foldable` in other places and see if we need to make any change.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152782305
  
    cc @marmbrus


---
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-11438] [SQL] Allow users to define nond...

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

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


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#discussion_r43603849
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala ---
    @@ -191,4 +193,86 @@ class UDFSuite extends QueryTest with SharedSQLContext {
         // pass a decimal to intExpected.
         assert(sql("SELECT intExpected(1.0)").head().getInt(0) === 1)
       }
    +
    +  private def checkNumUDFs(df: DataFrame, expectedNumUDFs: Int): Unit = {
    +    val udfs = df.queryExecution.optimizedPlan.collect {
    +      case p: logical.Project => p.projectList.flatMap {
    +        case e => e.collect {
    +          case udf: ScalaUDF => udf
    +        }
    +      }
    +    }.flatMap(functions => functions)
    +    assert(udfs.length === expectedNumUDFs)
    +  }
    +
    +  test("nondeterministic udf: using UDFRegistration") {
    +    import org.apache.spark.sql.functions._
    +
    +    val deterministicUDF = sqlContext.udf.register("plusOne1", (x: Int) => x + 1)
    +    val nondeterministicUDF = deterministicUDF.nonDeterministic
    +    sqlContext.udf.register("plusOne2", nondeterministicUDF)
    +
    +    {
    +      val df = sql("SELECT 1 as a")
    +        .select(col("a"), deterministicUDF(col("a")).as("b"))
    +        .select(col("a"), col("b"), deterministicUDF(col("b")).as("c"))
    +      checkNumUDFs(df, 3)
    --- End diff --
    
    The optimization rule `ConstantFolding` probably doesn't work as still the UDF number is 3, but should be 0, right?


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153191362
  
    **[Test build #44849 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44849/consoleFull)** for PR 9393 at commit [`d2ee5ee`](https://github.com/apache/spark/commit/d2ee5eee7c569b551779a2d73a98c84fd335a4ac).


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152783743
  
    Merged build finished. Test FAILed.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153218930
  
    **[Test build #44865 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44865/consoleFull)** for PR 9393 at commit [`d2ee5ee`](https://github.com/apache/spark/commit/d2ee5eee7c569b551779a2d73a98c84fd335a4ac).


---
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-11438] [SQL] Allow users to define nond...

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/9393#discussion_r43709078
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetIOSuite.scala ---
    @@ -381,7 +381,7 @@ class ParquetIOSuite extends QueryTest with ParquetTest with SharedSQLContext {
           sqlContext.udf.register("div0", (x: Int) => x / 0)
           withTempPath { dir =>
             intercept[org.apache.spark.SparkException] {
    -          sqlContext.sql("select div0(1)").write.parquet(dir.getCanonicalPath)
    +          sqlContext.range(1, 2).selectExpr("div0(id) as a").write.parquet(dir.getCanonicalPath)
    --- End diff --
    
    Ah, because we can do constant folding to `ScalaUDF` now. This is to make sure we will throw exception at executor side.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153216140
  
    **[Test build #44849 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44849/consoleFull)** for PR 9393 at commit [`d2ee5ee`](https://github.com/apache/spark/commit/d2ee5eee7c569b551779a2d73a98c84fd335a4ac).
     * This patch **fails Spark unit 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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153218537
  
     Merged build triggered.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#discussion_r43603749
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala ---
    @@ -30,13 +30,16 @@ case class ScalaUDF(
         function: AnyRef,
         dataType: DataType,
         children: Seq[Expression],
    -    inputTypes: Seq[DataType] = Nil)
    +    inputTypes: Seq[DataType] = Nil,
    +    isDeterministic: Boolean = true)
       extends Expression with ImplicitCastInputTypes with CodegenFallback {
     
       override def nullable: Boolean = true
     
       override def toString: String = s"UDF(${children.mkString(",")})"
     
    +  override def deterministic: Boolean = isDeterministic && children.forall(_.deterministic)
    --- End diff --
    
    We probably need to override the `foldable` as well. Something like:
    ```scala
    override def foldable: Boolean = deterministic && children.forall(_.foldable)
    ```
    Or change it in `Expression` directly?


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152784354
  
     Merged build triggered.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153215454
  
    LGTM


---
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-11438] [SQL] Allow users to define nond...

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/9393#discussion_r43708749
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetIOSuite.scala ---
    @@ -381,7 +381,7 @@ class ParquetIOSuite extends QueryTest with ParquetTest with SharedSQLContext {
           sqlContext.udf.register("div0", (x: Int) => x / 0)
           withTempPath { dir =>
             intercept[org.apache.spark.SparkException] {
    -          sqlContext.sql("select div0(1)").write.parquet(dir.getCanonicalPath)
    +          sqlContext.range(1, 2).selectExpr("div0(id) as a").write.parquet(dir.getCanonicalPath)
    --- End diff --
    
    why this change?


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152782872
  
    **[Test build #44741 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44741/consoleFull)** for PR 9393 at commit [`1fb28e4`](https://github.com/apache/spark/commit/1fb28e4d4421fc81dd05d2a0f2e83ce96fad596b).


---
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-11438] [SQL] Allow users to define nond...

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

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


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153176129
  
    **[Test build #44829 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44829/consoleFull)** for PR 9393 at commit [`0cdcb0b`](https://github.com/apache/spark/commit/0cdcb0b2eadda89898f4956df60bdd12eae6617b).
     * This patch **fails Spark unit 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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153142279
  
    Merged build started.


---
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-11469] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153242337
  
    @mengxr I am going to merge it. We can change the name of the public API in a follow-up PR.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153218601
  
    Merged build started.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152791602
  
    **[Test build #44743 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44743/consoleFull)** for PR 9393 at commit [`f7a476c`](https://github.com/apache/spark/commit/f7a476c4fea01a9546ee5b83cb77503ca1e7df00).
     * This patch **fails Spark unit 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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153190509
  
     Merged build triggered.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152802252
  
    **[Test build #44750 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44750/consoleFull)** for PR 9393 at commit [`f7a476c`](https://github.com/apache/spark/commit/f7a476c4fea01a9546ee5b83cb77503ca1e7df00).
     * This patch passes all 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-11469] [SQL] Allow users to define nond...

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

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


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#discussion_r43650981
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala ---
    @@ -30,13 +30,16 @@ case class ScalaUDF(
         function: AnyRef,
         dataType: DataType,
         children: Seq[Expression],
    -    inputTypes: Seq[DataType] = Nil)
    +    inputTypes: Seq[DataType] = Nil,
    +    isDeterministic: Boolean = true)
       extends Expression with ImplicitCastInputTypes with CodegenFallback {
     
       override def nullable: Boolean = true
     
       override def toString: String = s"UDF(${children.mkString(",")})"
     
    +  override def deterministic: Boolean = isDeterministic && children.forall(_.deterministic)
    --- End diff --
    
    This does seem reasonable.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153142252
  
     Merged build triggered.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153190522
  
    Merged build started.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152791608
  
    Merged build finished. Test FAILed.


---
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-11438] [SQL] Allow users to define nond...

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/9393#discussion_r43615454
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala ---
    @@ -30,13 +30,16 @@ case class ScalaUDF(
         function: AnyRef,
         dataType: DataType,
         children: Seq[Expression],
    -    inputTypes: Seq[DataType] = Nil)
    +    inputTypes: Seq[DataType] = Nil,
    +    isDeterministic: Boolean = true)
       extends Expression with ImplicitCastInputTypes with CodegenFallback {
     
       override def nullable: Boolean = true
     
       override def toString: String = s"UDF(${children.mkString(",")})"
     
    +  override def deterministic: Boolean = isDeterministic && children.forall(_.deterministic)
    --- End diff --
    
    I think we can't fold any nondeterministic expressions, we should make it a common behaviour of `Expression`


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153176209
  
    Merged build finished. Test FAILed.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153182111
  
    @yhuai This only applies to UDFs. What if a user uses built-in expressions, e.g.:
    
    ~~~scala
    val a = b + c
    val d = a * a
    ~~~
    
    It may be useful to write
    
    ~~~scala
    val a = (b + c).nondeterministic
    val d = a * a
    ~~~
    
    Btw, I would prefer `udf { x => x * x }.nondeterministic` instead of `nondeterministicUdf { x => x * x }`. But it is minor.


---
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-11438] [SQL] Allow users to define nond...

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/9393#discussion_r43598867
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala ---
    @@ -191,4 +193,86 @@ class UDFSuite extends QueryTest with SharedSQLContext {
         // pass a decimal to intExpected.
         assert(sql("SELECT intExpected(1.0)").head().getInt(0) === 1)
       }
    +
    +  private def checkNumUDFs(df: DataFrame, expectedNumUDFs: Int): Unit = {
    +    val udfs = df.queryExecution.optimizedPlan.collect {
    +      case p: logical.Project => p.projectList.flatMap {
    +        case e => e.collect {
    +          case udf: ScalaUDF => udf
    +        }
    +      }
    +    }.flatMap(functions => functions)
    --- End diff --
    
    We can just call `faltten`


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#discussion_r43674414
  
    --- Diff: project/MimaExcludes.scala ---
    @@ -112,6 +112,53 @@ object MimaExcludes {
               "org.apache.spark.rdd.MapPartitionsWithPreparationRDD"),
             ProblemFilters.exclude[MissingClassProblem](
               "org.apache.spark.rdd.MapPartitionsWithPreparationRDD$")
    +      ) ++ Seq(
    +        ProblemFilters.exclude[MissingMethodProblem](
    --- End diff --
    
    https://github.com/apache/spark/pull/9393#discussion-diff-43656205 shows the reason of these mima things.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152782279
  
     Merged build triggered.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152802264
  
    Merged build finished. Test PASSed.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152793034
  
    Merged build started.


---
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-11469] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153240205
  
    Merged build finished. Test PASSed.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#discussion_r43708876
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetIOSuite.scala ---
    @@ -381,7 +381,7 @@ class ParquetIOSuite extends QueryTest with ParquetTest with SharedSQLContext {
           sqlContext.udf.register("div0", (x: Int) => x / 0)
           withTempPath { dir =>
             intercept[org.apache.spark.SparkException] {
    -          sqlContext.sql("select div0(1)").write.parquet(dir.getCanonicalPath)
    +          sqlContext.range(1, 2).selectExpr("div0(id) as a").write.parquet(dir.getCanonicalPath)
    --- End diff --
    
    It will prevent us from triggering constant folding.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#discussion_r43657874
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala ---
    @@ -191,4 +193,86 @@ class UDFSuite extends QueryTest with SharedSQLContext {
         // pass a decimal to intExpected.
         assert(sql("SELECT intExpected(1.0)").head().getInt(0) === 1)
       }
    +
    +  private def checkNumUDFs(df: DataFrame, expectedNumUDFs: Int): Unit = {
    +    val udfs = df.queryExecution.optimizedPlan.collect {
    +      case p: logical.Project => p.projectList.flatMap {
    +        case e => e.collect {
    +          case udf: ScalaUDF => udf
    +        }
    +      }
    +    }.flatMap(functions => functions)
    +    assert(udfs.length === expectedNumUDFs)
    +  }
    +
    +  test("nondeterministic udf: using UDFRegistration") {
    +    import org.apache.spark.sql.functions._
    +
    +    val deterministicUDF = sqlContext.udf.register("plusOne1", (x: Int) => x + 1)
    +    val nondeterministicUDF = deterministicUDF.nonDeterministic
    +    sqlContext.udf.register("plusOne2", nondeterministicUDF)
    +
    +    {
    +      val df = sql("SELECT 1 as a")
    +        .select(col("a"), deterministicUDF(col("a")).as("b"))
    +        .select(col("a"), col("b"), deterministicUDF(col("b")).as("c"))
    +      checkNumUDFs(df, 3)
    --- End diff --
    
    The default value of `foldable` is false, which is why we see three expressions at here.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#discussion_r43651016
  
    --- Diff: project/MimaExcludes.scala ---
    @@ -112,6 +112,53 @@ object MimaExcludes {
               "org.apache.spark.rdd.MapPartitionsWithPreparationRDD"),
             ProblemFilters.exclude[MissingClassProblem](
               "org.apache.spark.rdd.MapPartitionsWithPreparationRDD$")
    +      ) ++ Seq(
    +        ProblemFilters.exclude[MissingMethodProblem](
    --- End diff --
    
    I'm a little confused what is going on here?


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#discussion_r43577572
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala ---
    @@ -191,4 +193,86 @@ class UDFSuite extends QueryTest with SharedSQLContext {
         // pass a decimal to intExpected.
         assert(sql("SELECT intExpected(1.0)").head().getInt(0) === 1)
       }
    +
    +  private def checkNumUDFs(df: DataFrame, expectedNumUDFs: Int): Unit = {
    +    val udfs = df.queryExecution.optimizedPlan.collect {
    +      case p: logical.Project => p.projectList.flatMap {
    +        case e => e.collect {
    +          case udf: ScalaUDF => udf
    +        }
    +      }
    +    }.flatMap(functions => functions)
    +    assert(udfs.length === expectedNumUDFs)
    +  }
    +
    +  test("nondeterministic udf: using UDFRegistration") {
    +    import org.apache.spark.sql.functions._
    +
    +    val deterministicUDF = sqlContext.udf.register("plusOne1", (x: Int) => x + 1)
    +    val nondeterministicUDF = deterministicUDF.nonDeterministic
    +    sqlContext.udf.register("plusOne2", nondeterministicUDF)
    +
    +    {
    +      val df = sql("SELECT 1 as a")
    +        .select(col("a"), deterministicUDF(col("a")).as("b"))
    +        .select(col("a"), col("b"), deterministicUDF(col("b")).as("c"))
    +      checkNumUDFs(df, 3)
    +      checkAnswer(df, Row(1, 2, 3))
    +    }
    +
    +    {
    +      val df = sql("SELECT 1 as a")
    +        .select(col("a"), callUDF("plusOne1", col("a")).as("b"))
    +        .select(col("a"), col("b"), callUDF("plusOne1", col("b")).as("c"))
    +      checkNumUDFs(df, 3)
    +      checkAnswer(df, Row(1, 2, 3))
    +    }
    +
    +    {
    +      val df = sql("SELECT 1 as a")
    +        .select(col("a"), nondeterministicUDF(col("a")).as("b"))
    +        .select(col("a"), col("b"), nondeterministicUDF(col("b")).as("c"))
    +      checkNumUDFs(df, 2)
    +      checkAnswer(df, Row(1, 2, 3))
    +    }
    +
    +    {
    +      val df = sql("SELECT 1 as a")
    +        .select(col("a"), callUDF("plusOne2", col("a")).as("b"))
    +        .select(col("a"), col("b"), callUDF("plusOne2", col("b")).as("c"))
    +      checkNumUDFs(df, 2)
    +      checkAnswer(df, Row(1, 2, 3))
    +    }
    +  }
    +
    +  test("nondeterministic udf: using udf function") {
    +    import org.apache.spark.sql.functions._
    +
    +    val deterministicUDF = udf((x: Int) => x + 1)
    +    val nondeterministicUDF = deterministicUDF.nonDeterministic
    +
    +    {
    +      val df = sql("SELECT 1 as a")
    +        .select(col("a"), deterministicUDF(col("a")).as("b"))
    +        .select(col("a"), col("b"), deterministicUDF(col("b")).as("c"))
    +      checkNumUDFs(df, 3)
    +      checkAnswer(df, Row(1, 2, 3))
    +    }
    +
    +    {
    +      val df = sql("SELECT 1 as a")
    +        .select(col("a"), nondeterministicUDF(col("a")).as("b"))
    +        .select(col("a"), col("b"), nondeterministicUDF(col("b")).as("c"))
    +      checkNumUDFs(df, 2)
    +      checkAnswer(df, Row(1, 2, 3))
    +    }
    +  }
    --- End diff --
    
    @mengxr Here are two examples to define nondeterministic UDFs.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152782316
  
    Merged build started.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153216201
  
    Merged build finished. Test FAILed.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152784360
  
    Merged build started.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152783730
  
    **[Test build #44741 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44741/consoleFull)** for PR 9393 at commit [`1fb28e4`](https://github.com/apache/spark/commit/1fb28e4d4421fc81dd05d2a0f2e83ce96fad596b).
     * 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-11438] [SQL] Allow users to define nond...

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

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


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152792953
  
    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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#discussion_r43656205
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/UDFRegistration.scala ---
    @@ -86,9 +104,9 @@ class UDFRegistration private[sql] (sqlContext: SQLContext) extends Logging {
             def register[$typeTags](name: String, func: Function$x[$types]): UserDefinedFunction = {
               val dataType = ScalaReflection.schemaFor[RT].dataType
               val inputTypes = Try($inputTypes).getOrElse(Nil)
    -          def builder(e: Seq[Expression]) = ScalaUDF(func, dataType, e, inputTypes)
    --- End diff --
    
    @marmbrus This kind of `builder`s caused the mima failure. Now, I am adding a build function in `ScalaUDF` because we need to get the value of `nondeterministic`.


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-152793754
  
    **[Test build #44750 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44750/consoleFull)** for PR 9393 at commit [`f7a476c`](https://github.com/apache/spark/commit/f7a476c4fea01a9546ee5b83cb77503ca1e7df00).


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153143211
  
    **[Test build #44829 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44829/consoleFull)** for PR 9393 at commit [`0cdcb0b`](https://github.com/apache/spark/commit/0cdcb0b2eadda89898f4956df60bdd12eae6617b).


---
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-11469] [SQL] Allow users to define nond...

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

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


---
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-11438] [SQL] Allow users to define nond...

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

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


---
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-11438] [SQL] Allow users to define nond...

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

    https://github.com/apache/spark/pull/9393#issuecomment-153217910
  
    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-11438] [SQL] Allow users to define nond...

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

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


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