Skip to content

Conversation

@huaxingao
Copy link
Contributor

What changes were proposed in this pull request?

Override the default SQL strings in Postgres Dialect for:

  • ALTER TABLE UPDATE COLUMN TYPE
  • ALTER TABLE UPDATE COLUMN NULLABILITY

Add new docker integration test suite jdbc/v2/PostgreSQLIntegrationSuite.scala

Why 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

@SparkQA
Copy link

SparkQA commented Oct 18, 2020

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34577/

@SparkQA
Copy link

SparkQA commented Oct 19, 2020

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34578/

@SparkQA
Copy link

SparkQA commented Oct 19, 2020

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34577/

@SparkQA
Copy link

SparkQA commented Oct 19, 2020

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34578/

@SparkQA
Copy link

SparkQA commented Oct 19, 2020

Test build #129970 has finished for PR 30089 at commit 9ca0e1c.

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

@huaxingao
Copy link
Contributor Author

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens in Oracle?

Copy link
Contributor Author

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)
assert(msg.contains("Table not found"))
}

test("SPARK-33034: ALTER TABLE ... rename column") {
Copy link
Contributor Author

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

Copy link
Contributor

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.

@SparkQA
Copy link

SparkQA commented Oct 22, 2020

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34774/

@SparkQA
Copy link

SparkQA commented Oct 22, 2020

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34774/

@SparkQA
Copy link

SparkQA commented Oct 22, 2020

Test build #130167 has finished for PR 30089 at commit c97f12a.

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

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

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.

@huaxingao
Copy link
Contributor Author

@cloud-fan I removed rename column test because @ScrapCodes has a follow up #30142 to address the rename problem.

@SparkQA
Copy link

SparkQA commented Oct 23, 2020

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34808/

@SparkQA
Copy link

SparkQA commented Oct 23, 2020

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34808/

@SparkQA
Copy link

SparkQA commented Oct 23, 2020

Test build #130208 has finished for PR 30089 at commit 89c5045.

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

@huaxingao
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Oct 23, 2020

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34813/

@SparkQA
Copy link

SparkQA commented Oct 23, 2020

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34813/

@SparkQA
Copy link

SparkQA commented Oct 23, 2020

Test build #130213 has finished for PR 30089 at commit 89c5045.

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

@ScrapCodes
Copy link
Member

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.


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 _")
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@SparkQA
Copy link

SparkQA commented Oct 26, 2020

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34895/

@SparkQA
Copy link

SparkQA commented Oct 26, 2020

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34895/

@SparkQA
Copy link

SparkQA commented Oct 26, 2020

Test build #130294 has finished for PR 30089 at commit c9f264a.

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

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in f284218 Oct 27, 2020
@huaxingao
Copy link
Contributor Author

Thanks!

@huaxingao huaxingao deleted the postgres_docker branch October 27, 2020 16:02
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.

5 participants