You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by gaborfeher <gi...@git.apache.org> on 2017/05/02 10:25:25 UTC

[GitHub] spark pull request #17830: [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL ...

GitHub user gaborfeher opened a pull request:

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

    [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL types to Spark types

    ## What changes were proposed in this pull request?
    
    This change removes the custom code from `OracleDialect`, that was mapping some of Oracle's `DECIMAL(X, Y)` types to `BooleanType`, `IntegerType`, `LongType` or `FloatType`.
    
    ## How was this patch tested?
    
    I used the following command to run the docker-bases integration tests:
    ```
    ./build/mvn -Pdocker-integration-tests -pl :spark-docker-integration-tests_2.11 test
    ```
    
    Please review http://spark.apache.org/contributing.html before opening a pull request.


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

    $ git pull https://github.com/gaborfeher/spark gaborfeher-oracle-dialect

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

    https://github.com/apache/spark/pull/17830.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 #17830
    
----
commit 2dadd29b6713e9f19ce001614a30cfa9ff003f77
Author: Gabor Feher <ga...@lynxanalytics.com>
Date:   2017-04-28T12:02:51Z

    Do not create custom catalyst types from Oracle decimal columns

commit 9fad6eba76c37a461b659e2a957a79817920023f
Author: Gabor Feher <ga...@lynxanalytics.com>
Date:   2017-04-28T15:23:45Z

    fix and add tests

----


---
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 #17830: [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL types t...

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

    https://github.com/apache/spark/pull/17830
  
    ping @gaborfeher 


---
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 #17830: [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL types t...

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

    https://github.com/apache/spark/pull/17830
  
    Hi, thanks for the review! I definitely want to continue, but I'll only have more time to look into this next week. (I don't exactly know how I ended up with that broken test, because I was able to run some tests locally. I think, at least.)


---
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 #17830: [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL types t...

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

    https://github.com/apache/spark/pull/17830
  
    Thank you, I am happy to see the issue is taken care of! (I don't know the customs here, we can also share the credit.)


---
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 #17830: [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL types t...

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

    https://github.com/apache/spark/pull/17830
  
    Can one of the admins verify this patch?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17830: [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL types t...

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

    https://github.com/apache/spark/pull/17830
  
    @gaborfeher Since the PR has been merged, could you please close it? 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 #17830: [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL types t...

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

    https://github.com/apache/spark/pull/17830
  
    ok to test


---
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 #17830: [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL types t...

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

    https://github.com/apache/spark/pull/17830
  
    **[Test build #77952 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/77952/testReport)** for PR 17830 at commit [`3f841c7`](https://github.com/apache/spark/commit/3f841c72b27cdee496ece39e17d4bb88dcf61714).
     * 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 #17830: [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL ...

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

    https://github.com/apache/spark/pull/17830#discussion_r121557744
  
    --- Diff: external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/OracleIntegrationSuite.scala ---
    @@ -148,27 +172,28 @@ class OracleIntegrationSuite extends DockerJDBCIntegrationSuite with SharedSQLCo
         val dfRead = spark.read.jdbc(jdbcUrl, tableName, props)
         val rows = dfRead.collect()
         // verify the data type is inserted
    -    val types = rows(0).toSeq.map(x => x.getClass.toString)
    -    assert(types(0).equals("class java.lang.Boolean"))
    -    assert(types(1).equals("class java.lang.Integer"))
    -    assert(types(2).equals("class java.lang.Long"))
    -    assert(types(3).equals("class java.lang.Float"))
    -    assert(types(4).equals("class java.lang.Float"))
    -    assert(types(5).equals("class java.lang.Integer"))
    -    assert(types(6).equals("class java.lang.Integer"))
    -    assert(types(7).equals("class java.lang.String"))
    -    assert(types(8).equals("class [B"))
    -    assert(types(9).equals("class java.sql.Date"))
    -    assert(types(10).equals("class java.sql.Timestamp"))
    +    val types = dfRead.schema.map(field => field.dataType)
    +    assert(types(0).equals(DecimalType(1, 0)))
    +    assert(types(1).equals(DecimalType(10, 0)))
    +    assert(types(2).equals(DecimalType(19, 0)))
    +    assert(types(3).equals(DecimalType(19, 4)))
    +    assert(types(4).equals(DecimalType(19, 4)))
    +    assert(types(5).equals(DecimalType(3, 0)))
    +    assert(types(6).equals(DecimalType(5, 0)))
    +    assert(types(7).equals(StringType))
    +    assert(types(8).equals(BinaryType))
    +    assert(types(9).equals(DateType))
    +    assert(types(10).equals(TimestampType))
    +
         // verify the value is the inserted correct or not
         val values = rows(0)
    -    assert(values.getBoolean(0).equals(booleanVal))
    -    assert(values.getInt(1).equals(integerVal))
    -    assert(values.getLong(2).equals(longVal))
    -    assert(values.getFloat(3).equals(floatVal))
    -    assert(values.getFloat(4).equals(doubleVal.toFloat))
    -    assert(values.getInt(5).equals(byteVal.toInt))
    -    assert(values.getInt(6).equals(shortVal.toInt))
    +    assert(values.getDecimal(0).compareTo(BigDecimal.valueOf(booleanVal ? 1 : 0)) == 0)
    --- End diff --
    
    This does not work. The conditional operator `? :` is not supported by Scala.


---
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 #17830: [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL types t...

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

    https://github.com/apache/spark/pull/17830
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/77952/
    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 issue #17830: [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL types t...

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

    https://github.com/apache/spark/pull/17830
  
    This is a pretty serious bug. Let me resolve the failure as a separate PR. Will give all the credits to you when we merging the PR. Thank you for your fix! 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17830: [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL types t...

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

    https://github.com/apache/spark/pull/17830
  
    **[Test build #77952 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/77952/testReport)** for PR 17830 at commit [`3f841c7`](https://github.com/apache/spark/commit/3f841c72b27cdee496ece39e17d4bb88dcf61714).


---
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 #17830: [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL ...

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

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


---
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 #17830: [SPARK-20555][SQL] Fix mapping of Oracle DECIMAL types t...

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

    https://github.com/apache/spark/pull/17830
  
    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