Skip to content

[SPARK-33452][SQL] Support v2 SHOW PARTITIONS #30398

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
wants to merge 46 commits into from

Conversation

MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Nov 17, 2020

What changes were proposed in this pull request?

  1. Remove V2 logical node ShowPartitionsStatement , and replace it by V2 ShowPartitions.
  2. Implement V2 execution node ShowPartitionsExec similar to V1 ShowPartitionsCommand.

Why are the changes needed?

To have feature parity with Datasource V1.

Does this PR introduce any user-facing change?

Yes.

Before the change, SHOW PARTITIONS fails in V2 table catalogs with the exception:

org.apache.spark.sql.AnalysisException: SHOW PARTITIONS is only supported with v1 tables.
   at org.apache.spark.sql.catalyst.analysis.ResolveSessionCatalog.org$apache$spark$sql$catalyst$analysis$ResolveSessionCatalog$$parseV1Table(ResolveSessionCatalog.scala:628)
   at org.apache.spark.sql.catalyst.analysis.ResolveSessionCatalog$$anonfun$apply$1.applyOrElse(ResolveSessionCatalog.scala:466)

How was this patch tested?

By running the following test suites:

  1. Modified ShowPartitionsParserSuite where ShowPartitionsStatement is replaced by V2 ShowPartitions.
  2. v2.ShowPartitionsSuite

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

SparkQA commented Nov 17, 2020

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

@SparkQA
Copy link

SparkQA commented Nov 17, 2020

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

@SparkQA
Copy link

SparkQA commented Nov 17, 2020

Test build #131219 has finished for PR 30398 at commit c62b30b.

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

@SparkQA
Copy link

SparkQA commented Nov 17, 2020

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

@SparkQA
Copy link

SparkQA commented Nov 17, 2020

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

@SparkQA
Copy link

SparkQA commented Nov 17, 2020

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

@SparkQA
Copy link

SparkQA commented Nov 17, 2020

Test build #131230 has finished for PR 30398 at commit 7e06381.

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

@SparkQA
Copy link

SparkQA commented Nov 17, 2020

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

@SparkQA
Copy link

SparkQA commented Nov 17, 2020

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

@SparkQA
Copy link

SparkQA commented Nov 17, 2020

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

@SparkQA
Copy link

SparkQA commented Nov 17, 2020

Test build #131231 has finished for PR 30398 at commit 9cbbbe1.

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

@SparkQA
Copy link

SparkQA commented Nov 17, 2020

Test build #131234 has finished for PR 30398 at commit ade84ba.

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

@SparkQA
Copy link

SparkQA commented Nov 18, 2020

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

@SparkQA
Copy link

SparkQA commented Nov 18, 2020

Test build #131277 has finished for PR 30398 at commit 8700ed5.

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

@SparkQA
Copy link

SparkQA commented Nov 18, 2020

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

@SparkQA
Copy link

SparkQA commented Nov 25, 2020

Test build #131805 has finished for PR 30398 at commit 1cd1e34.

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

@MaxGekk
Copy link
Member Author

MaxGekk commented Nov 26, 2020

jenkins, retest this, please

@SparkQA
Copy link

SparkQA commented Nov 26, 2020

Test build #131834 has finished for PR 30398 at commit 1cd1e34.

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

@MaxGekk
Copy link
Member Author

MaxGekk commented Nov 26, 2020

jenkins, retest this, please

@SparkQA
Copy link

SparkQA commented Nov 26, 2020

Test build #131839 has finished for PR 30398 at commit 1cd1e34.

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

@MaxGekk
Copy link
Member Author

MaxGekk commented Nov 26, 2020

jenkins, retest this, please

@SparkQA
Copy link

SparkQA commented Nov 26, 2020

Test build #131852 has finished for PR 30398 at commit 1cd1e34.

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

@MaxGekk
Copy link
Member Author

MaxGekk commented Nov 26, 2020

jenkins, retest this, please

@SparkQA
Copy link

SparkQA commented Nov 26, 2020

Test build #131853 has finished for PR 30398 at commit 1cd1e34.

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

UnresolvedPartitionSpec(visitNonOptionalPartitionSpec(specCtx), None)
}
ShowPartitions(
UnresolvedTableOrView(multiPart.getOrElse(Seq.empty[String])),
Copy link
Contributor

Choose a reason for hiding this comment

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

If it doesn't support view, why not use UnresolvedTable?

Copy link
Member Author

Choose a reason for hiding this comment

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

To output proper error as for V1.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

V1:

if (table.tableType == VIEW) {
throw new AnalysisException(s"SHOW PARTITIONS is not allowed on a view: $tableIdentWithDB")
}

Copy link
Contributor

Choose a reason for hiding this comment

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

then we should improve the v2 error message like #30475

Copy link
Member Author

@MaxGekk MaxGekk Nov 27, 2020

Choose a reason for hiding this comment

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

One of purpose of this PR is to create v2 implementation compatible to v1. I would prefer to avoid changing v1 impl at least in this PR since v1 is out of the scope.

Copy link
Member Author

Choose a reason for hiding this comment

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

  • I replaced by UnresolvedTableOrView by UnresolvedTable, and
  • removed some checks from CheckAnalysis.checkShowPartitions()

@SparkQA
Copy link

SparkQA commented Nov 28, 2020

Test build #131900 has finished for PR 30398 at commit d3c344a.

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

UnresolvedPartitionSpec(visitNonOptionalPartitionSpec(specCtx), None)
}
ShowPartitions(
UnresolvedTable(multiPart.getOrElse(Seq.empty[String]), "SHOW PARTITIONS"),
Copy link
Contributor

@cloud-fan cloud-fan Nov 30, 2020

Choose a reason for hiding this comment

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

multiPart.getOrElse(Seq.empty[String]) this looks weird. How can the table name be Seq.empty? And I don't see other parser rules doing the same thing. They are simply using visitMultipartIdentifier(ctx.multipartIdentifier). Why do we diverge here?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

@cloud-fan cloud-fan left a comment

Choose a reason for hiding this comment

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

LGTM except one comment

…ions-exec-v2

# Conflicts:
#	sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolvePartitionSpec.scala
@cloud-fan
Copy link
Contributor

GA passed, merging to master, thanks!

@cloud-fan cloud-fan closed this in 0a612b6 Nov 30, 2020
@SparkQA
Copy link

SparkQA commented Nov 30, 2020

Test build #131979 has finished for PR 30398 at commit dc211e6.

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

@MaxGekk MaxGekk deleted the show-partitions-exec-v2 branch February 19, 2021 15:03
LuciferYang pushed a commit that referenced this pull request Aug 1, 2024
…r's` comments

### What changes were proposed in this pull request?
The pr aims to fix the outdated `logical plan name` in `AstBuilder's` comments.

### Why are the changes needed?
- After the pr #33609, the name of the logical plan below has been changed:
  `AlterTableAddColumns` -> `AddColumns`
  `AlterTableRenameColumn` -> `RenameColumn`
  `AlterTableAlterColumn` -> `AlterColumn`
  `AlterTableDropColumns` -> `DropColumns`

- After the pr #30398
The name of the logical plan `ShowPartitionsStatement` has been changed to `ShowPartitions`.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Only update comments.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes #47562 from panbingkun/fix_astbuilder.

Lead-authored-by: panbingkun <[email protected]>
Co-authored-by: panbingkun <[email protected]>
Signed-off-by: yangjie01 <[email protected]>
fusheng9399 pushed a commit to fusheng9399/spark that referenced this pull request Aug 6, 2024
…r's` comments

### What changes were proposed in this pull request?
The pr aims to fix the outdated `logical plan name` in `AstBuilder's` comments.

### Why are the changes needed?
- After the pr apache#33609, the name of the logical plan below has been changed:
  `AlterTableAddColumns` -> `AddColumns`
  `AlterTableRenameColumn` -> `RenameColumn`
  `AlterTableAlterColumn` -> `AlterColumn`
  `AlterTableDropColumns` -> `DropColumns`

- After the pr apache#30398
The name of the logical plan `ShowPartitionsStatement` has been changed to `ShowPartitions`.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Only update comments.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#47562 from panbingkun/fix_astbuilder.

Lead-authored-by: panbingkun <[email protected]>
Co-authored-by: panbingkun <[email protected]>
Signed-off-by: yangjie01 <[email protected]>
attilapiros pushed a commit to attilapiros/spark that referenced this pull request Oct 4, 2024
…r's` comments

### What changes were proposed in this pull request?
The pr aims to fix the outdated `logical plan name` in `AstBuilder's` comments.

### Why are the changes needed?
- After the pr apache#33609, the name of the logical plan below has been changed:
  `AlterTableAddColumns` -> `AddColumns`
  `AlterTableRenameColumn` -> `RenameColumn`
  `AlterTableAlterColumn` -> `AlterColumn`
  `AlterTableDropColumns` -> `DropColumns`

- After the pr apache#30398
The name of the logical plan `ShowPartitionsStatement` has been changed to `ShowPartitions`.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Only update comments.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#47562 from panbingkun/fix_astbuilder.

Lead-authored-by: panbingkun <[email protected]>
Co-authored-by: panbingkun <[email protected]>
Signed-off-by: yangjie01 <[email protected]>
himadripal pushed a commit to himadripal/spark that referenced this pull request Oct 19, 2024
…r's` comments

### What changes were proposed in this pull request?
The pr aims to fix the outdated `logical plan name` in `AstBuilder's` comments.

### Why are the changes needed?
- After the pr apache#33609, the name of the logical plan below has been changed:
  `AlterTableAddColumns` -> `AddColumns`
  `AlterTableRenameColumn` -> `RenameColumn`
  `AlterTableAlterColumn` -> `AlterColumn`
  `AlterTableDropColumns` -> `DropColumns`

- After the pr apache#30398
The name of the logical plan `ShowPartitionsStatement` has been changed to `ShowPartitions`.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Only update comments.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#47562 from panbingkun/fix_astbuilder.

Lead-authored-by: panbingkun <[email protected]>
Co-authored-by: panbingkun <[email protected]>
Signed-off-by: yangjie01 <[email protected]>
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