Skip to content

Conversation

@twdsilva
Copy link
Contributor

@twdsilva twdsilva commented Dec 29, 2018

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

@twdsilva
Copy link
Contributor Author

FYI @JoshRosen @hvanhovell

@HyukjinKwon
Copy link
Member

I think we should also update migration guide.

@HyukjinKwon
Copy link
Member

ok to test

@HyukjinKwon
Copy link
Member

adding @maropu and @wangyum

@SparkQA
Copy link

SparkQA commented Dec 29, 2018

Test build #100534 has finished for PR 23400 at commit 749afc3.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@twdsilva
Copy link
Contributor Author

In order to update the migration guide, would I have to create a separate PR for https://github.com/apache/spark-website ?

@twdsilva
Copy link
Contributor Author

I will investigate why the PySpark unit tests are failing.

@HyukjinKwon
Copy link
Member

@HyukjinKwon
Copy link
Member

PySpark test failure looks orthogonal with this change.

… test that uses custom JdbcDialect that maps TINYINT to ByteType
@SparkQA
Copy link

SparkQA commented Dec 30, 2018

Test build #100547 has finished for PR 23400 at commit c202053.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@twdsilva twdsilva changed the title [SPARK-26499] [SQL] JdbcUtils.getCatalystType maps TINYINT to IntegerType instead of Byte… [SPARK-26499] [SQL] JdbcUtils.makeGetter does not handle ByteType Dec 30, 2018
@HyukjinKwon
Copy link
Member

HyukjinKwon commented Dec 30, 2018

Looks good. For completeness, the integration test should be a good to do.

@twdsilva
Copy link
Contributor Author

@HyukjinKwon I ran the docker integration tests and they all passed

Run completed in 15 minutes, 45 seconds.
Total number of tests run: 21
Suites: completed 5, aborted 0
Tests: succeeded 21, failed 0, canceled 0, ignored 5, pending 0
All tests passed.
18/12/29 22:59:25 INFO ShutdownHookManager: Shutdown hook called
18/12/29 22:59:25 INFO ShutdownHookManager: Deleting directory /Users/tdsilva/spark-twdsilva/external/docker-integration-tests/target/tmp/spark-0e1546d2-c0ca-41f1-a063-802348dee0fb
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  16:46 min
[INFO] Finished at: 2018-12-29T22:59:25-08:00
[INFO] ------------------------------------------------------------------------

@SparkQA
Copy link

SparkQA commented Dec 30, 2018

Test build #100548 has finished for PR 23400 at commit ae34533.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Dec 30, 2018

Test build #100552 has finished for PR 23400 at commit ae34533.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

Let me leave this open for few more days before getting it merged.

@SparkQA
Copy link

SparkQA commented Dec 31, 2018

Test build #100582 has finished for PR 23400 at commit 1c487b7.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@kiszk
Copy link
Member

kiszk commented Dec 31, 2018

retest this please

@SparkQA
Copy link

SparkQA commented Dec 31, 2018

Test build #100586 has finished for PR 23400 at commit 1c487b7.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Dec 31, 2018

Test build #100591 has finished for PR 23400 at commit 1c487b7.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

retest this please

Copy link
Member

@srowen srowen left a 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

@SparkQA
Copy link

SparkQA commented Dec 31, 2018

Test build #100593 has finished for PR 23400 at commit 1c487b7.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 1, 2019

Test build #100599 has finished for PR 23400 at commit a5dedac.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

retest this please

1 similar comment
@HyukjinKwon
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Jan 1, 2019

Test build #100601 has finished for PR 23400 at commit a5dedac.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 1, 2019

Test build #4491 has finished for PR 23400 at commit a5dedac.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 1, 2019

Test build #100602 has finished for PR 23400 at commit a5dedac.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

Merged to master.

@asfgit asfgit closed this in 5f0ddd2 Jan 1, 2019
jackylee-ch pushed a commit to jackylee-ch/spark that referenced this pull request Feb 18, 2019
…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]>
shivsood pushed a commit to shivsood/spark that referenced this pull request Nov 14, 2019
…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]>
dongjoon-hyun pushed a commit that referenced this pull request Nov 15, 2019
## 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]>
srowen pushed a commit that referenced this pull request Nov 15, 2019
…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)
Copy link
Member

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.

Copy link
Member

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)
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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~

Copy link
Member

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

@twdsilva twdsilva deleted the tiny_int_support branch November 19, 2019 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants