Skip to content

[SPARK-33505][SQL][TESTS] Fix adding new partitions by INSERT INTO InMemoryPartitionTable #30449

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

Closed

Conversation

MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Nov 20, 2020

What changes were proposed in this pull request?

  1. Add a hook method to addPartitionKey() of InMemoryTable which is called per every row.
  2. Override addPartitionKey() in InMemoryPartitionTable, and add partition key every time when new row is inserted to the table.

Why are the changes needed?

To be able to write unified tests for datasources V1 and V2. Currently, INSERT INTO a V1 table creates partitions but the same doesn't work for the custom catalog InMemoryPartitionTableCatalog used in DSv2 tests.

Does this PR introduce any user-facing change?

No

How was this patch tested?

By running the affected test suite DataSourceV2SQLSuite.

@github-actions github-actions bot added the SQL label Nov 20, 2020
@SparkQA
Copy link

SparkQA commented Nov 20, 2020

Test build #131438 has finished for PR 30449 at commit dc0c6d8.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member

Thanks, @MaxGekk .

@MaxGekk
Copy link
Member Author

MaxGekk commented Nov 20, 2020

I think it would be nice to check that insert into the same partition doesn't fail. I will add one more insert into.

@SparkQA
Copy link

SparkQA commented Nov 20, 2020

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

@SparkQA
Copy link

SparkQA commented Nov 20, 2020

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

@SparkQA
Copy link

SparkQA commented Nov 20, 2020

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

sql(s"INSERT INTO $t PARTITION(id = 1, city = 'NY') SELECT 'abc'")
assert(partTable.partitionExists(expectedPartitionIdent))
// Insert into the existing partition must not fail
sql(s"INSERT INTO $t PARTITION(id = 1, city = 'NY') SELECT 'def'")
Copy link
Member

Choose a reason for hiding this comment

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

Yep. Good to have. +1.

@SparkQA
Copy link

SparkQA commented Nov 20, 2020

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

@SparkQA
Copy link

SparkQA commented Nov 21, 2020

Test build #131439 has finished for PR 30449 at commit ff0f1f8.

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

@SparkQA
Copy link

SparkQA commented Nov 21, 2020

Test build #131443 has finished for PR 30449 at commit 362e8b8.

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

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM. Thanks, @MaxGekk .
Merged to master.

@MaxGekk MaxGekk deleted the insert-into-InMemoryPartitionTable branch February 19, 2021 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants