Skip to content

Conversation

@gengliangwang
Copy link
Member

What changes were proposed in this pull request?

This is a regression between Spark 3.5.0 and Spark 4.
The following queries work on Spark 3.5.0 while fails on latest master branch:

CREATE TABLE test_current_user(i int, s string) USING parquet;
ALTER TABLE test_current_user ALTER COLUMN s SET DEFAULT current_user()
CREATE TABLE test_current_user(i int, s string default current_user()) USING parquet
INSERT INTO test_current_user (i) VALUES ((0));

This PR is to complete fixing this by eagerly executing finish-analysis and constant-folding rules before checking whether the expression is foldable and resolved.

Why are the changes needed?

Bug fix

Does this PR introduce any user-facing change?

No

How was this patch tested?

New UTs

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

No

…tions

This is a regression between Spark 3.5.0 and Spark 4.
The following queries work on Spark 3.5.0 while fails on latest master branch:
```
CREATE TABLE test_current_user(i int, s string) USING parquet;
ALTER TABLE test_current_user ALTER COLUMN s SET DEFAULT current_user()
```
```
CREATE TABLE test_current_user(i int, s string default current_user()) USING parquet
INSERT INTO test_current_user (i) VALUES ((0));
```

This PR is to complete fixing this by eagerly executing finish-analysis and constant-folding rules before checking whether the expression is foldable and resolved.

Bug fix

No

New UTs

No

Closes apache#47529 from gengliangwang/finishAnalysis.

Authored-by: Gengliang Wang <[email protected]>
Signed-off-by: Gengliang Wang <[email protected]>
@github-actions github-actions bot added the SQL label Jul 30, 2024
@gengliangwang gengliangwang changed the title [SPARK-49054][SQL] Column default value should support current_* functions [SPARK-49054][SQL][3.5] Column default value should support current_* functions Jul 30, 2024
gengliangwang added a commit that referenced this pull request Jul 30, 2024
… functions

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

This is a regression between Spark 3.5.0 and Spark 4.
The following queries work on Spark 3.5.0 while fails on latest master branch:
```
CREATE TABLE test_current_user(i int, s string) USING parquet;
ALTER TABLE test_current_user ALTER COLUMN s SET DEFAULT current_user()
```
```
CREATE TABLE test_current_user(i int, s string default current_user()) USING parquet
INSERT INTO test_current_user (i) VALUES ((0));
```

This PR is to complete fixing this by eagerly executing finish-analysis and constant-folding rules before checking whether the expression is foldable and resolved.
### Why are the changes needed?

Bug fix

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

No
### How was this patch tested?

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

No

Closes #47538 from gengliangwang/pickFinishAnlysis.

Authored-by: Gengliang Wang <[email protected]>
Signed-off-by: Gengliang Wang <[email protected]>
@gengliangwang
Copy link
Member Author

Merged to branch-3.5

turboFei pushed a commit to turboFei/spark that referenced this pull request Nov 6, 2025
… functions (apache#539)

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

This is a regression between Spark 3.5.0 and Spark 4.
The following queries work on Spark 3.5.0 while fails on latest master branch:
```
CREATE TABLE test_current_user(i int, s string) USING parquet;
ALTER TABLE test_current_user ALTER COLUMN s SET DEFAULT current_user()
```
```
CREATE TABLE test_current_user(i int, s string default current_user()) USING parquet
INSERT INTO test_current_user (i) VALUES ((0));
```

This PR is to complete fixing this by eagerly executing finish-analysis and constant-folding rules before checking whether the expression is foldable and resolved.
### Why are the changes needed?

Bug fix

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

No
### How was this patch tested?

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

No

Closes apache#47538 from gengliangwang/pickFinishAnlysis.

Authored-by: Gengliang Wang <[email protected]>

Signed-off-by: Gengliang Wang <[email protected]>
Co-authored-by: Gengliang Wang <[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.

2 participants