-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
[SPARK-19004][SQL] Fix JDBCWriteSuite.testH2Dialect
by removing getCatalystType
#16409
Conversation
Hi, @gatorsmile . |
Test build #70612 has finished for PR 16409 at commit
|
@@ -44,9 +44,6 @@ class JDBCWriteSuite extends SharedSQLContext with BeforeAndAfter { | |||
|
|||
val testH2Dialect = new JdbcDialect { | |||
override def canHandle(url: String) : Boolean = url.startsWith("jdbc:h2") | |||
override def getCatalystType( |
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.
If we get rid of this, how can it pass the test case "Remap types via JdbcDialects". At least, it failed in my local environement.
This overwrite was intentionally introduced for testing JdbcDialect. See the PR: #5498
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 review, @gatorsmile .
JdbcDialect
should handle a few DBMS specific types and should return None
for general types. The schema is handled in general in the following fallback logic.
The current implementation is wrong because it returns always StringType
for all kind types of columns.
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 know that is wrong, but this customized getCatalystType
is used to test whether the customized getCatalystType
are taking effects.
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'll check that again for test.
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.
For the failure, I see that it's due to complaining the correct result.
List(StructField(THEID,IntegerType,false)) was not empty
ScalaTestFailureLocation: org.apache.spark.sql.jdbc.JDBCSuite$$anonfun$39 at (JDBCSuite.scala:616)
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.
First of all, it's my bad that I didn't notice that there were two testH2Dialect
.
Now, I understand that this is intentional for the specific test case Remap types via JdbcDialects
, but it seems to be only valid for JDBCSuite.scala
.
I mean we can use a normal JdbcDialect in JDBCWriteSuite
because it's a different suite. Actually, while making #15664, I got stuck by this bug.
Is it possible to fix this correctly in JDBCWriterSuite
only as this PR proposed?
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.
uh, I see. you are removing testH2Dialect
in JDBCWriteSuite.scala
. I am fine about this change. Please update the PR title, and the PR/JIRA description.
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 so much, @gatorsmile .
I update the title and description of this PR and JIRA together.
testH2Dialect
by removing getCatalystType
JDBCWriteSuite.testH2Dialect
by removing getCatalystType
Thanks! Merging to master. |
Thank you for review and merging! |
…tCatalystType` ## What changes were proposed in this pull request? `JDBCSuite` and `JDBCWriterSuite` have their own `testH2Dialect`s for their testing purposes. This PR fixes `testH2Dialect` in `JDBCWriterSuite` by removing `getCatalystType` implementation in order to return correct types. Currently, it always returns `Some(StringType)` incorrectly. Note that, for the `testH2Dialect` in `JDBCSuite`, it's intentional because of the test case `Remap types via JdbcDialects`. ## How was this patch tested? This is a test only update. Author: Dongjoon Hyun <dongjoon@apache.org> Closes apache#16409 from dongjoon-hyun/SPARK-H2-DIALECT.
…tCatalystType` ## What changes were proposed in this pull request? `JDBCSuite` and `JDBCWriterSuite` have their own `testH2Dialect`s for their testing purposes. This PR fixes `testH2Dialect` in `JDBCWriterSuite` by removing `getCatalystType` implementation in order to return correct types. Currently, it always returns `Some(StringType)` incorrectly. Note that, for the `testH2Dialect` in `JDBCSuite`, it's intentional because of the test case `Remap types via JdbcDialects`. ## How was this patch tested? This is a test only update. Author: Dongjoon Hyun <dongjoon@apache.org> Closes apache#16409 from dongjoon-hyun/SPARK-H2-DIALECT.
What changes were proposed in this pull request?
JDBCSuite
andJDBCWriterSuite
have their owntestH2Dialect
s for their testing purposes.This PR fixes
testH2Dialect
inJDBCWriterSuite
by removinggetCatalystType
implementation in order to return correct types. Currently, it always returnsSome(StringType)
incorrectly. Note that, for thetestH2Dialect
inJDBCSuite
, it's intentional because of the test caseRemap types via JdbcDialects
.How was this patch tested?
This is a test only update.