-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-26499] [SQL] JdbcUtils.makeGetter does not handle ByteType #23400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala
Outdated
Show resolved
Hide resolved
|
I think we should also update migration guide. |
|
ok to test |
|
Test build #100534 has finished for PR 23400 at commit
|
|
In order to update the migration guide, would I have to create a separate PR for https://github.com/apache/spark-website ? |
|
I will investigate why the PySpark unit tests are failing. |
|
Migration guide is located in https://github.com/apache/spark/blob/master/docs/sql-migration-guide-upgrade.md |
|
PySpark test failure looks orthogonal with this change. |
… test that uses custom JdbcDialect that maps TINYINT to ByteType
|
Test build #100547 has finished for PR 23400 at commit
|
|
Looks good. For completeness, the integration test should be a good to do. |
|
@HyukjinKwon I ran the docker integration tests and they all passed |
|
Test build #100548 has finished for PR 23400 at commit
|
|
retest this please |
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala
Outdated
Show resolved
Hide resolved
|
Test build #100552 has finished for PR 23400 at commit
|
|
Let me leave this open for few more days before getting it merged. |
|
Test build #100582 has finished for PR 23400 at commit
|
|
retest this please |
|
Test build #100586 has finished for PR 23400 at commit
|
|
retest this please |
|
Test build #100591 has finished for PR 23400 at commit
|
|
retest this please |
srowen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK by me; I don't see any harm in supporting it
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala
Outdated
Show resolved
Hide resolved
|
Test build #100593 has finished for PR 23400 at commit
|
|
Test build #100599 has finished for PR 23400 at commit
|
|
retest this please |
1 similar comment
|
retest this please |
|
Test build #100601 has finished for PR 23400 at commit
|
|
Test build #4491 has finished for PR 23400 at commit
|
|
Test build #100602 has finished for PR 23400 at commit
|
|
Merged to master. |
…Type ## What changes were proposed in this pull request? Modifed JdbcUtils.makeGetter to handle ByteType. ## How was this patch tested? Added a new test to JDBCSuite that maps ```TINYINT``` to ```ByteType```. Closes apache#23400 from twdsilva/tiny_int_support. Authored-by: Thomas D'Silva <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
…Type ## What changes were proposed in this pull request? Modifed JdbcUtils.makeGetter to handle ByteType. ## How was this patch tested? Added a new test to JDBCSuite that maps ```TINYINT``` to ```ByteType```. Closes apache#23400 from twdsilva/tiny_int_support. Authored-by: Thomas D'Silva <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
## What changes were proposed in this pull request? This is a port of SPARK-26499 to 2.4 Modifed JdbcUtils.makeGetter to handle ByteType. ## How was this patch tested? Added a new test to JDBCSuite that maps ```TINYINT``` to ```ByteType```. Closes #23400 from twdsilva/tiny_int_support. Authored-by: Thomas D'Silva <tdsilvaapache.org> Signed-off-by: Hyukjin Kwon <gurwls223apache.org> ### Why are the changes needed? Changes are required to port pr #26301 (SPARK-29644) to 2.4 ### Does this PR introduce any user-facing change? No ### How was this patch tested? Yes, tested on 2.4 with using docker integration test for MySQL, MsSQLServer, Postgres ``sh /build/mvn test -Pdocker-integration-tests -pl :spark-docker-integration-tests_2.11 -Dtest=none -DwildcardSuites=org.apache.spark.sql.jdbc.MySQLIntegrationSuite ./build/mvn test -Pdocker-integration-tests -pl :spark-docker-integration-tests_2.11 -Dtest=none -DwildcardSuites=org.apache.spark.sql.jdbc.MsSqlServerIntegrationSuite ./build/mvn test -Pdocker-integration-tests -pl :spark-docker-integration-tests_2.11 -Dtest=none -DwildcardSuites=org.apache.spark.sql.jdbc.PostgresIntegrationSuite `` Closes #26531 from shivsood/pr_26499_2.4_port. Lead-authored-by: shivsood <[email protected]> Co-authored-by: Thomas D'Silva <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
…eType in JdbcUtils.makeGetter ### What changes were proposed in this pull request? This is a follow-up pr to fix the code coming from #23400; it replaces `update` with `setByte` for ByteType in `JdbcUtils.makeGetter`. ### Why are the changes needed? For better code. ### Does this PR introduce any user-facing change? No. ### How was this patch tested? Existing tests. Closes #26532 from maropu/SPARK-26499-FOLLOWUP. Authored-by: Takeshi Yamamuro <[email protected]> Signed-off-by: Sean Owen <[email protected]>
| size: Int, | ||
| md: MetadataBuilder): Option[DataType] = { | ||
| sqlType match { | ||
| case java.sql.Types.TINYINT => Some(ByteType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if this is okay in this H2 dialect context.
We made testH2DialectTinyInt like this, but theoretically, TINYINT is still unsigned and Spark ByteType is signed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think we found similar issue in another PR. @twdsilva can you check and fix it if needed?
| } | ||
|
|
||
| test("Map TINYINT to ByteType via JdbcDialects") { | ||
| JdbcDialects.registerDialect(testH2DialectTinyInt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, @dongjoon-hyun, actually this test seems fine. The test dialect seems only scoped for this specific case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although it's a bit odd given #23400 (comment), at least this test is scoped and won't affect other tests about unsigned TINYINT cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally, I suspected this dialect is valid for H2 database's type.
Luckily, TINYINT of H2 database seems to be also -128 to 127.
In this case, I'm okay~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for verifying this case @dongjoon-hyun
…Type
What changes were proposed in this pull request?
Modifed JdbcUtils.makeGetter to handle ByteType.
How was this patch tested?
Added a new test to JDBCSuite that maps
TINYINTtoByteType.