-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[SPARK-33137][SQL] Support ALTER TABLE in JDBC v2 Table Catalog: update type and nullability of columns (Postgres dialect) #30089
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
|
Kubernetes integration test starting |
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Kubernetes integration test status success |
|
Test build #129970 has finished for PR 30089 at commit
|
|
cc @cloud-fan @MaxGekk thanks |
| sql(s"ALTER TABLE $catalogName.alt_table DROP COLUMN c3") | ||
| val t = spark.table(s"$catalogName.alt_table") | ||
| val expectedSchema = catalogName match { | ||
| case "oracle" => new StructType().add("C2", DecimalType(10, 0)) |
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.
what happens in Oracle?
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.
Oracle uses NUMBER(10) for integer. Please see https://docs.oracle.com/cd/E19501-01/819-3659/gcmaz/
…te type and nullability of columns (PostgreSQL dialect)
9ca0e1c to
c97f12a
Compare
| assert(msg.contains("Table not found")) | ||
| } | ||
|
|
||
| test("SPARK-33034: ALTER TABLE ... rename column") { |
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.
MySQLIntegrationSuite fails on this test. The docker image we have for MySQL is 5.7.31. Seems MySQL 5.7 doesn't support syntax ALTER TABLE tbl_name RENAME COLUMN old_col_name TO new_col_name but 8.0 does.
https://dev.mysql.com/doc/refman/5.7/en/alter-table.html
https://dev.mysql.com/doc/refman/8.0/en/alter-table.html
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.
We can either upgrade the MySQL version in docker test, or override the test in MySQLIntegrationSuite to assert the failure.
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #130167 has finished for PR 30089 at commit
|
| sql(s"ALTER TABLE $catalogName.alt_table RENAME COLUMN id TO C") | ||
| val t = spark.table(s"$catalogName.alt_table") | ||
| val expectedSchema = catalogName match { | ||
| case "oracle" => new StructType().add("C", DecimalType(10, 0)).add("C0", DecimalType(10, 0)) |
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.
to work around it, shall we use string or boolean type instead? It's testing rename so the type doesn't matter.
|
@cloud-fan I removed rename column test because @ScrapCodes has a follow up #30142 to address the rename problem. |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #130208 has finished for PR 30089 at commit
|
|
retest this please |
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #130213 has finished for PR 30089 at commit
|
|
Hi @huaxingao, I wasn't aware of this parallel work here. And created another PR #30142. I am going to copy your rename test and may be you could take a look at the other PR. |
...cker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/v2/DB2IntegrationSuite.scala
Show resolved
Hide resolved
|
|
||
| test("SPARK-33034: ALTER TABLE ... drop column") { | ||
| withTable(s"$catalogName.alt_table") { | ||
| sql(s"CREATE TABLE $catalogName.alt_table (C1 INTEGER, C2 INTEGER, c3 INTEGER) USING _") |
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.
since it's DROP COLUMN test, the type doesn't matter. Can we use boolean or string type to avoid the oracle special 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.
Changed. Sorry I didn't see this last time.
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #130294 has finished for PR 30089 at commit
|
|
thanks, merging to master! |
|
Thanks! |
What changes were proposed in this pull request?
Override the default SQL strings in Postgres Dialect for:
Add new docker integration test suite
jdbc/v2/PostgreSQLIntegrationSuite.scalaWhy are the changes needed?
supports Postgres specific ALTER TABLE syntax.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Add new test
PostgreSQLIntegrationSuite