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 2017/01/03 21:08:43 UTC

[GitHub] spark pull request #16463: [SPARK-18877][SQL][BACKPORT-2.1] `CSVInferSchema....

GitHub user dongjoon-hyun opened a pull request:

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

    [SPARK-18877][SQL][BACKPORT-2.1] `CSVInferSchema.inferField` on DecimalType should find a common type with `typeSoFar`

    ## What changes were proposed in this pull request?
    
    CSV type inferencing causes `IllegalArgumentException` on decimal numbers with heterogeneous precisions and scales because the current logic uses the last decimal type in a **partition**. Specifically, `inferRowType`, the **seqOp** of **aggregate**, returns the last decimal type. This PR fixes it to use `findTightestCommonType`.
    
    **decimal.csv**
    ```
    9.03E+12
    1.19E+11
    ```
    
    **BEFORE**
    ```scala
    scala> spark.read.format("csv").option("inferSchema", true).load("decimal.csv").printSchema
    root
     |-- _c0: decimal(3,-9) (nullable = true)
    
    scala> spark.read.format("csv").option("inferSchema", true).load("decimal.csv").show
    16/12/16 14:32:49 ERROR Executor: Exception in task 0.0 in stage 4.0 (TID 4)
    java.lang.IllegalArgumentException: requirement failed: Decimal precision 4 exceeds max precision 3
    ```
    
    **AFTER**
    ```scala
    scala> spark.read.format("csv").option("inferSchema", true).load("decimal.csv").printSchema
    root
     |-- _c0: decimal(4,-9) (nullable = true)
    
    scala> spark.read.format("csv").option("inferSchema", true).load("decimal.csv").show
    +---------+
    |      _c0|
    +---------+
    |9.030E+12|
    | 1.19E+11|
    +---------+
    ```
    
    
    ## How was this patch tested?
    
    Pass the newly add test case.

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

    $ git pull https://github.com/dongjoon-hyun/spark SPARK-18877-BACKPORT-21

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

    https://github.com/apache/spark/pull/16463.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 #16463
    
----
commit 7d4f31eb32b35f89ea5d3c7c8fa9c08e025d3ee1
Author: Dongjoon Hyun <do...@apache.org>
Date:   2017-01-03T15:06:50Z

    [SPARK-18877][SQL][BACKPORT-2.1] `CSVInferSchema.inferField` on DecimalType should find a common type with `typeSoFar`
    
    CSV type inferencing causes `IllegalArgumentException` on decimal numbers with heterogeneous precisions and scales because the current logic uses the last decimal type in a **partition**. Specifically, `inferRowType`, the **seqOp** of **aggregate**, returns the last decimal type. This PR fixes it to use `findTightestCommonType`.
    
    **decimal.csv**
    ```
    9.03E+12
    1.19E+11
    ```
    
    **BEFORE**
    ```scala
    scala> spark.read.format("csv").option("inferSchema", true).load("decimal.csv").printSchema
    root
     |-- _c0: decimal(3,-9) (nullable = true)
    
    scala> spark.read.format("csv").option("inferSchema", true).load("decimal.csv").show
    16/12/16 14:32:49 ERROR Executor: Exception in task 0.0 in stage 4.0 (TID 4)
    java.lang.IllegalArgumentException: requirement failed: Decimal precision 4 exceeds max precision 3
    ```
    
    **AFTER**
    ```scala
    scala> spark.read.format("csv").option("inferSchema", true).load("decimal.csv").printSchema
    root
     |-- _c0: decimal(4,-9) (nullable = true)
    
    scala> spark.read.format("csv").option("inferSchema", true).load("decimal.csv").show
    +---------+
    |      _c0|
    +---------+
    |9.030E+12|
    | 1.19E+11|
    +---------+
    ```
    
    Pass the newly add test case.
    
    Author: Dongjoon Hyun <do...@apache.org>
    
    Closes #16320 from dongjoon-hyun/SPARK-18877.

----


---
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 issue #16463: [SPARK-18877][SQL][BACKPORT-2.1] `CSVInferSchema.inferFi...

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

    https://github.com/apache/spark/pull/16463
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/70829/
    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 issue #16463: [SPARK-18877][SQL][BACKPORT-2.1] `CSVInferSchema.inferFi...

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

    https://github.com/apache/spark/pull/16463
  
    Thank you for review, @jaceklaskowski .


---
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 #16463: [SPARK-18877][SQL][BACKPORT-2.1] `CSVInferSchema....

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

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


---
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 issue #16463: [SPARK-18877][SQL][BACKPORT-2.1] `CSVInferSchema.inferFi...

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

    https://github.com/apache/spark/pull/16463
  
    Hi, @gatorsmile .
    This is a backport of https://github.com/apache/spark/pull/16320 .


---
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 issue #16463: [SPARK-18877][SQL][BACKPORT-2.1] `CSVInferSchema.inferFi...

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

    https://github.com/apache/spark/pull/16463
  
    **[Test build #70829 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/70829/testReport)** for PR 16463 at commit [`7d4f31e`](https://github.com/apache/spark/commit/7d4f31eb32b35f89ea5d3c7c8fa9c08e025d3ee1).
     * 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 issue #16463: [SPARK-18877][SQL][BACKPORT-2.1] `CSVInferSchema.inferFi...

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

    https://github.com/apache/spark/pull/16463
  
    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 issue #16463: [SPARK-18877][SQL][BACKPORT-2.1] `CSVInferSchema.inferFi...

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

    https://github.com/apache/spark/pull/16463
  
    Could you please close it and open one for branch 2.0? Thanks!


---
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 issue #16463: [SPARK-18877][SQL][BACKPORT-2.1] `CSVInferSchema.inferFi...

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

    https://github.com/apache/spark/pull/16463
  
    **[Test build #70829 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/70829/testReport)** for PR 16463 at commit [`7d4f31e`](https://github.com/apache/spark/commit/7d4f31eb32b35f89ea5d3c7c8fa9c08e025d3ee1).


---
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 issue #16463: [SPARK-18877][SQL][BACKPORT-2.1] `CSVInferSchema.inferFi...

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

    https://github.com/apache/spark/pull/16463
  
    LGTM. Thanks, merging to 2.1!


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