Skip to content

refactor(query): optimize alter table modify column default-only path#19424

Open
dantengsky wants to merge 21 commits intodatabendlabs:mainfrom
dantengsky:feat/main-branch-alter-col-type-no-write
Open

refactor(query): optimize alter table modify column default-only path#19424
dantengsky wants to merge 21 commits intodatabendlabs:mainfrom
dantengsky:feat/main-branch-alter-col-type-no-write

Conversation

@dantengsky
Copy link
Member

@dantengsky dantengsky commented Feb 8, 2026

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

  • Default-only ALTER TABLE ... MODIFY COLUMN ... DEFAULT ... updates metadata only (no table data rewrite)
  • The new default is still validated during ALTER; invalid defaults are rejected
  • Time travel is unchanged: each snapshot keeps its own default_expr
  • Non-deterministic defaults (for example rand()) force a rebuild to materialize stable values

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Pair with the reviewer to explain why

Type of change

  • Refactoring

This change is Reviewable

@github-actions github-actions bot added the pr-bugfix this PR patches a bug in codebase label Feb 8, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a0f6ea6012

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dantengsky dantengsky added C-refactoring Category: refactor and removed pr-bugfix this PR patches a bug in codebase labels Feb 8, 2026
@dantengsky dantengsky changed the title fix(query): skip rewrite for default-only modify column refact(query): skip table data rewrite for default-only modify column Feb 8, 2026
@dantengsky dantengsky changed the title refact(query): skip table data rewrite for default-only modify column refactor(query): optimize alter table modify column default-only path Feb 8, 2026
@github-actions github-actions bot added the pr-refactor this PR changes the code base without new features or bugfix label Feb 8, 2026
@dantengsky
Copy link
Member Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. 🎉

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dantengsky
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 13f622e982

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

…hema changes

Metadata-only default changes can silently alter historical row values
without producing change records, breaking stream/CDC consistency.
@databendlabs databendlabs deleted a comment from github-actions bot Feb 10, 2026
@dantengsky
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a1278c6347

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dantengsky
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b91c87d5a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

parse_and_bind wraps type-mismatched results in CastExpr, so
nextval(seq) on an INT column becomes CastExpr(AsyncFunctionCall).
The top-level matches! missed it. Use default_value_evaluable()
which recursively walks the ScalarExpr tree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-refactoring Category: refactor pr-refactor this PR changes the code base without new features or bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant