You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by dongjoon-hyun <gi...@git.apache.org> on 2016/05/27 10:29:34 UTC

[GitHub] spark pull request: [SPARK-15612][SQL] Raise exception if decimal ...

GitHub user dongjoon-hyun opened a pull request:

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

    [SPARK-15612][SQL] Raise exception if decimal `scale` >= `precision`

    ## What changes were proposed in this pull request?
    
    Currently, Spark raises exceptions only when decimal `scale` > `precision`. However, the value becames `null` if `scale` = `precision`. We should raise exceptions for that case, too.
    
    **Before**
    ```scala
    scala> sql("select cast('1' as Decimal(2,1))")
    res0: org.apache.spark.sql.DataFrame = [CAST(1 AS DECIMAL(2,1)): decimal(2,1)]
    
    scala> sql("select cast('1' as Decimal(2,2))")
    res1: org.apache.spark.sql.DataFrame = [CAST(1 AS DECIMAL(2,2)): decimal(2,2)]
    
    scala> sql("select cast('1' as Decimal(2,3))")
    org.apache.spark.sql.catalyst.parser.ParseException:
    Decimal scale (3) cannot be greater than precision (2).
    
    scala> sql("select cast('1' as Decimal(2,1))").head
    res2: org.apache.spark.sql.Row = [1.0]
    
    scala> sql("select cast('1' as Decimal(2,2))").head
    res3: org.apache.spark.sql.Row = [null]
    ```
    
    **After**
    ```scala
    scala> sql("select cast('1' as Decimal(2,1))")
    res0: org.apache.spark.sql.DataFrame = [CAST(1 AS DECIMAL(2,1)): decimal(2,1)]
    
    scala> sql("select cast('1' as Decimal(2,2))")
    org.apache.spark.sql.catalyst.parser.ParseException:
    Decimal scale (2) must be less than precision (2).
    ```
    
    ## How was this patch tested?
    
    Pass the Jenkins tests (with a new testcase)

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

    $ git pull https://github.com/dongjoon-hyun/spark SPARK-15612

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

    https://github.com/apache/spark/pull/13358.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 #13358
    
----
commit 03e76984fbf702e067ae3ee4b2aee88a0f94e23e
Author: Dongjoon Hyun <do...@apache.org>
Date:   2016-05-27T10:24:58Z

    [SPARK-15612][SQL] Raise exception if decimal `scale` >= `precision`

----


---
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-15612][SQL] Raise exception if decimal ...

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

    https://github.com/apache/spark/pull/13358#issuecomment-222115736
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/59486/
    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-15612][SQL] Raise exception if decimal ...

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

    https://github.com/apache/spark/pull/13358#issuecomment-222115716
  
    **[Test build #59486 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/59486/consoleFull)** for PR 13358 at commit [`03e7698`](https://github.com/apache/spark/commit/03e76984fbf702e067ae3ee4b2aee88a0f94e23e).
     * 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-15612][SQL] Raise exception if decimal ...

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

    https://github.com/apache/spark/pull/13358#issuecomment-222125693
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/59487/
    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-15612][SQL] Raise exception if decimal ...

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

    https://github.com/apache/spark/pull/13358#issuecomment-222116246
  
    **[Test build #59487 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/59487/consoleFull)** for PR 13358 at commit [`7d9ae14`](https://github.com/apache/spark/commit/7d9ae14f285cb8fe07f7a89fafa03832e6d91432).


---
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-15612][SQL] Raise exception if decimal ...

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

    https://github.com/apache/spark/pull/13358#issuecomment-222115735
  
    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-15612][SQL] Raise exception if decimal ...

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

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


---
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-15612][SQL] Raise exception if decimal ...

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

    https://github.com/apache/spark/pull/13358#issuecomment-222125581
  
    **[Test build #59487 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/59487/consoleFull)** for PR 13358 at commit [`7d9ae14`](https://github.com/apache/spark/commit/7d9ae14f285cb8fe07f7a89fafa03832e6d91432).
     * 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-15612][SQL] Raise exception if decimal ...

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

    https://github.com/apache/spark/pull/13358#issuecomment-222114509
  
    **[Test build #59486 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/59486/consoleFull)** for PR 13358 at commit [`03e7698`](https://github.com/apache/spark/commit/03e76984fbf702e067ae3ee4b2aee88a0f94e23e).


---
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-15612][SQL] Raise exception if decimal ...

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

    https://github.com/apache/spark/pull/13358#issuecomment-222125689
  
    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