You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by sarutak <gi...@git.apache.org> on 2014/11/21 10:55:51 UTC

[GitHub] spark pull request: [SPARK-4536][SQL] Add sqrt and abs to Spark SQ...

GitHub user sarutak opened a pull request:

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

    [SPARK-4536][SQL] Add sqrt and abs to Spark SQL DSL

    Spark SQL havs embeded sqrt and abs but DSL doesn't support those functions.

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

    $ git pull https://github.com/sarutak/spark dsl-missing-operator

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

    https://github.com/apache/spark/pull/3401.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 #3401
    
----
commit 0396f89f7572b09575d4a36a89d7281f460173a2
Author: Kousuke Saruta <sa...@oss.nttdata.co.jp>
Date:   2014-11-21T09:54:51Z

    Added sqrt and abs to Spark SQL DSL

----


---
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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#discussion_r21131198
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/DslQuerySuite.scala ---
    @@ -282,4 +283,72 @@ class DslQuerySuite extends QueryTest {
           (1, "1", "11") :: (2, "2", "22") :: (3, "3", "33") :: Nil
         )
       }
    +
    +  test("sqrt") {
    +    checkAnswer(
    +      testData.select(sqrt('key)).orderBy('key asc),
    +      (1 to 100).map(n => Seq(math.sqrt(n)))
    +    )
    +
    +    checkAnswer(
    +      testData.select(sqrt('value), 'key).orderBy('key asc, 'value asc),
    +      (1 to 100).map(n => Seq(math.sqrt(n), n))
    +    )
    +
    +    checkAnswer(
    +      testData.select(sqrt(Literal(null, NullType))),
    +      (1 to 100).map(_ => Seq(null))
    +    )
    +  }
    +
    +  test("abs") {
    +    checkAnswer(
    +      testData.select(abs('key)).orderBy('key asc),
    +      (1 to 100).map(n => Seq(n))
    +    )
    +
    +    checkAnswer(
    +      negativeData.select(abs('key)).orderBy('key desc),
    +      (1 to 100).map(n => Seq(n))
    +    )
    +
    +    checkAnswer(
    +      testData.select(abs(Literal(null, NullType))),
    +      (1 to 100).map(_ => Seq(null))
    +    )
    +  }
    +
    +  test("upper") {
    +    checkAnswer(
    +      lowerCaseData.select(upper('l)),
    +      ('a' to 'd').map(c => Seq(c.toString.toUpperCase()))
    +    )
    +
    +    checkAnswer(
    +      testData.select(upper('value), 'key),
    +      (1 to 100).map(n => Seq(n.toString, n))
    +    )
    +
    +    checkAnswer(
    +      testData.select(upper(Literal(null, NullType))),
    --- End diff --
    
    Nit: This can just be `Literal(null)`


---
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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#issuecomment-63948961
  
      [Test build #23720 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/23720/consoleFull) for   PR 3401 at commit [`0396f89`](https://github.com/apache/spark/commit/0396f89f7572b09575d4a36a89d7281f460173a2).
     * This patch merges cleanly.


---
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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#issuecomment-65178372
  
      [Test build #24016 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/24016/consoleFull) for   PR 3401 at commit [`07700cf`](https://github.com/apache/spark/commit/07700cf5dabaa54ae879c3d09b030d0c6e622860).
     * 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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#issuecomment-65172981
  
      [Test build #24015 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/24015/consoleFull) for   PR 3401 at commit [`bc5f4cb`](https://github.com/apache/spark/commit/bc5f4cbabc1ec4c7670195f7c69f71e6977e7f22).
     * 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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#issuecomment-65010425
  
      [Test build #23962 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/23962/consoleFull) for   PR 3401 at commit [`1b88e2e`](https://github.com/apache/spark/commit/1b88e2ea0e602f1f21dca958e91520d701d191cc).
     * This patch merges cleanly.


---
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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#issuecomment-65172988
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/24015/
    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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#issuecomment-65015612
  
      [Test build #23962 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/23962/consoleFull) for   PR 3401 at commit [`1b88e2e`](https://github.com/apache/spark/commit/1b88e2ea0e602f1f21dca958e91520d701d191cc).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `  trait ConnectionFactory extends Serializable `



---
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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#issuecomment-65178375
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/24016/
    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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#issuecomment-65015614
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/23962/
    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-4536][SQL] Add sqrt and abs to Spark SQ...

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

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


---
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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#issuecomment-65295741
  
    Thanks!  Merged to master and 1.2.


---
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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#issuecomment-63956555
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/23720/
    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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#issuecomment-63956546
  
      [Test build #23720 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/23720/consoleFull) for   PR 3401 at commit [`0396f89`](https://github.com/apache/spark/commit/0396f89f7572b09575d4a36a89d7281f460173a2).
     * 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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#issuecomment-65172365
  
      [Test build #24015 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/24015/consoleFull) for   PR 3401 at commit [`bc5f4cb`](https://github.com/apache/spark/commit/bc5f4cbabc1ec4c7670195f7c69f71e6977e7f22).
     * This patch merges cleanly.


---
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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#discussion_r21135915
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/DslQuerySuite.scala ---
    @@ -282,4 +283,72 @@ class DslQuerySuite extends QueryTest {
           (1, "1", "11") :: (2, "2", "22") :: (3, "3", "33") :: Nil
         )
       }
    +
    +  test("sqrt") {
    +    checkAnswer(
    +      testData.select(sqrt('key)).orderBy('key asc),
    +      (1 to 100).map(n => Seq(math.sqrt(n)))
    +    )
    +
    +    checkAnswer(
    +      testData.select(sqrt('value), 'key).orderBy('key asc, 'value asc),
    +      (1 to 100).map(n => Seq(math.sqrt(n), n))
    +    )
    +
    +    checkAnswer(
    +      testData.select(sqrt(Literal(null, NullType))),
    +      (1 to 100).map(_ => Seq(null))
    +    )
    +  }
    +
    +  test("abs") {
    +    checkAnswer(
    +      testData.select(abs('key)).orderBy('key asc),
    +      (1 to 100).map(n => Seq(n))
    +    )
    +
    +    checkAnswer(
    +      negativeData.select(abs('key)).orderBy('key desc),
    +      (1 to 100).map(n => Seq(n))
    +    )
    +
    +    checkAnswer(
    +      testData.select(abs(Literal(null, NullType))),
    +      (1 to 100).map(_ => Seq(null))
    +    )
    +  }
    +
    +  test("upper") {
    +    checkAnswer(
    +      lowerCaseData.select(upper('l)),
    +      ('a' to 'd').map(c => Seq(c.toString.toUpperCase()))
    +    )
    +
    +    checkAnswer(
    +      testData.select(upper('value), 'key),
    +      (1 to 100).map(n => Seq(n.toString, n))
    +    )
    +
    +    checkAnswer(
    +      testData.select(upper(Literal(null, NullType))),
    --- End diff --
    
    Thanks! I've modified.


---
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-4536][SQL] Add sqrt and abs to Spark SQ...

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

    https://github.com/apache/spark/pull/3401#issuecomment-65174072
  
      [Test build #24016 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/24016/consoleFull) for   PR 3401 at commit [`07700cf`](https://github.com/apache/spark/commit/07700cf5dabaa54ae879c3d09b030d0c6e622860).
     * This patch merges cleanly.


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