Skip to content

[SPARK-55631][SQL] ALTER TABLE must invalidate cache for DSv2 tables#54427

Closed
aokolnychyi wants to merge 1 commit intoapache:masterfrom
aokolnychyi:spark-55631
Closed

[SPARK-55631][SQL] ALTER TABLE must invalidate cache for DSv2 tables#54427
aokolnychyi wants to merge 1 commit intoapache:masterfrom
aokolnychyi:spark-55631

Conversation

@aokolnychyi
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR makes ALTER TABLE command invalidate cache.

Why are the changes needed?

These changes are needed to reflect changes made in the session correctly.

Does this PR introduce any user-facing change?

ALTER TABLE commands will now invalidate cache.

How was this patch tested?

This PR comes with test that would previously fail.

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

No.

@aokolnychyi
Copy link
Copy Markdown
Contributor Author

Copy link
Copy Markdown
Member

@szehon-ho szehon-ho left a comment

Choose a reason for hiding this comment

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

it makes sense / safer to invalidate to me. I guess it is for V2 (pr title could reflect it)

@aokolnychyi aokolnychyi changed the title [SPARK-55631][SQL] ALTER TABLE must invalidate cache [SPARK-55631][SQL] ALTER TABLE must invalidate cache for DSv2 tables Feb 23, 2026

val result = sql(s"SELECT * FROM $t ORDER BY id")
assertCached(result)
checkAnswer(result, Seq(Row(1, "a", null), Row(2, "b", null)))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what was the error message before this PR?

Copy link
Copy Markdown
Contributor Author

@aokolnychyi aokolnychyi Feb 25, 2026

Choose a reason for hiding this comment

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

This would return successfully but use the cached state (old schema), which breaks the assumption that session changes are always propagated and visible.

Copy link
Copy Markdown
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.

@gengliangwang
Copy link
Copy Markdown
Member

Thanks, merging to master

@manuzhang
Copy link
Copy Markdown
Member

@aokolnychyi do we need this fix for branch-4.1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants