Skip to content
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-51726][SQL] Use TableInfo for Stage CREATE/REPLACE/CREATE OR REPLACE table #50521

Closed
wants to merge 1 commit into from

Conversation

anoopj
Copy link
Contributor

@anoopj anoopj commented Apr 5, 2025

What changes were proposed in this pull request?

Followup of #50137 for the table replace methods in StagingTableCatalog.

Why are the changes needed?

To make it easier to add new parameters such as constraints.

Does this PR introduce any user-facing change?

Yes, but backwards compatible by providing a default implementation.

How was this patch tested?

Existing tests

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

No

@github-actions github-actions bot added the SQL label Apr 5, 2025
@anoopj anoopj force-pushed the replace branch 2 times, most recently from f5d87e7 to b3862da Compare April 5, 2025 06:29
@HyukjinKwon HyukjinKwon changed the title [SPARK-51726] Use TableInfo for Stage CREATE/REPLACE/CREATE OR REPLACE table [SPARK-51726][SQL] Use TableInfo for Stage CREATE/REPLACE/CREATE OR REPLACE table Apr 7, 2025
Transform[] partitions,
Map<String, String> properties) throws TableAlreadyExistsException, NoSuchNamespaceException {
return stageCreate(ident, CatalogV2Util.v2ColumnsToStructType(columns), partitions, properties);
default StagedTable stageCreate(Identifier ident, TableInfo tableInfo)
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional: My personal preference would be to format it this way:

default StagedTable stageCreate(
    Identifier ident,
    TableInfo tableInfo) throws TableAlreadyExistsException, NoSuchNamespaceException {
  ...
}

Transform[] partitions,
Map<String, String> properties) throws NoSuchNamespaceException, NoSuchTableException {
return stageReplace(
ident, CatalogV2Util.v2ColumnsToStructType(columns), partitions, properties);
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional: What about putting each argument on a separate line?

Copy link
Member

Choose a reason for hiding this comment

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

This seems consistent with existing code in this file

Map<String, String> properties) throws NoSuchNamespaceException, NoSuchTableException {
return stageReplace(
ident, CatalogV2Util.v2ColumnsToStructType(columns), partitions, properties);
default StagedTable stageReplace(Identifier ident, TableInfo tableInfo)
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional: Same comment about formatting as in create.

Map<String, String> properties) throws NoSuchNamespaceException {
return stageCreateOrReplace(
ident, CatalogV2Util.v2ColumnsToStructType(columns), partitions, properties);
default StagedTable stageCreateOrReplace(Identifier ident, TableInfo tableInfo)
Copy link
Contributor

Choose a reason for hiding this comment

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

Here too, method + invocation.

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