Skip to content

Conversation

@cloud-fan
Copy link
Contributor

What changes were proposed in this pull request?

Following generated columns, column default value should also have a catalog capability and v2 catalogs must explicitly declare SUPPORT_COLUMN_DEFAULT_VALUE to support it.

Why are the changes needed?

column default value needs dedicated handling and if a catalog simply ignores it, then query result can be wrong.

Does this PR introduce any user-facing change?

No

How was this patch tested?

new tests

@github-actions github-actions bot added the SQL label Mar 6, 2023
@cloud-fan
Copy link
Contributor Author

cc @gengliangwang @dtenedor

Copy link
Member

@gengliangwang gengliangwang 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

Copy link
Contributor

@dtenedor dtenedor left a comment

Choose a reason for hiding this comment

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

This is a good safeguard for correctness.

ident: Identifier): Unit = {
if (SQLConf.get.enableDefaultColumns &&
schema.exists(_.metadata.contains(CURRENT_DEFAULT_COLUMN_METADATA_KEY))) {
if (!catalog.capabilities().contains(
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 combine with the previous if statement using &&?

@cloud-fan
Copy link
Contributor Author

thanks for review, merging to master/3.4!

@cloud-fan cloud-fan closed this in 69dd20b Mar 8, 2023
cloud-fan added a commit that referenced this pull request Mar 8, 2023
…y default

### What changes were proposed in this pull request?

Following generated columns, column default value should also have a catalog capability and v2 catalogs must explicitly declare SUPPORT_COLUMN_DEFAULT_VALUE to support it.

### Why are the changes needed?

column default value needs dedicated handling and if a catalog simply ignores it, then query result can be wrong.

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

No

### How was this patch tested?

new tests

Closes #40299 from cloud-fan/default.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
(cherry picked from commit 69dd20b)
Signed-off-by: Wenchen Fan <[email protected]>
snmvaughan pushed a commit to snmvaughan/spark that referenced this pull request Jun 20, 2023
…y default

### What changes were proposed in this pull request?

Following generated columns, column default value should also have a catalog capability and v2 catalogs must explicitly declare SUPPORT_COLUMN_DEFAULT_VALUE to support it.

### Why are the changes needed?

column default value needs dedicated handling and if a catalog simply ignores it, then query result can be wrong.

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

No

### How was this patch tested?

new tests

Closes apache#40299 from cloud-fan/default.

Authored-by: Wenchen Fan <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
(cherry picked from commit 69dd20b)
Signed-off-by: Wenchen Fan <[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