hubgeter opened a new pull request, #70220:
URL: https://github.com/apache/doris/pull/70220
### What problem does this PR solve?
Issue Number: N/A
Related PR: #65851, #69488, #69499
Problem Summary:
`ALTER TABLE ... ADD COLUMN added INT NOT NULL DEFAULT 7` is rejected even
on an Iceberg format-version 3 table. Nested additions also reject DEFAULT in
their separate grammar and metadata validation.
Reuse the full column definition for nested paths and share SDK staging for
top-level single/batch additions, STRUCT children, ARRAY element children and
MAP value children. Preserve requiredness and set both initial and write
defaults. Validate the loaded table's format version before committing; keep
batch atomicity, path/position validation and statement-bound write-schema
checks. NULL parents remain NULL, and explicit NULL in a supplied required
field remains an error.
Correct the default conversion reached by these additions: Boolean `0`/`1`
keep their value, and DATE/DATETIME SQL literals are accepted with fractional
seconds preserved. Invalid Boolean strings fail. Normalize external SQL civil
dates and timestamps, including compact forms and session-zone TIMESTAMPTZ
literals, before connector conversion. Existing numeric epoch inputs remain
accepted by connector callers. Iceberg SHOW CREATE, DESC and information_schema
default presentation retain their current behavior.
### Release note
Iceberg format-version 3 tables support adding top-level and nested NOT NULL
fields with non-null literal defaults. Boolean and SQL temporal defaults are
converted correctly. Format-version 1 and 2 tables continue to reject non-null
column defaults.
### Check List (For Author)
- Test
- [x] Regression test
- [x] Unit Test
- [x] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason
Validation:
- Final focused `run-fe-ut.sh` run: 81 tests passed, covering real SDK
commits, typed defaults, temporal precision/session zones, parser and ALTER
command behavior. Earlier connector/parser runs also passed (313 tests).
- Final `build.sh --fe`, Checkstyle and connector architecture gates: passed
(Checkstyle: 0 violations).
- `run-regression-test.sh --run -d external_table_p0/iceberg -s
test_iceberg_add_column_defaults`: passed: script-generated output and normal
comparison for Parquet/ORC, old/new files, nested NULLs, typed/compact/zoned
defaults, failures and v1/v2 rejection.
- Local read/write validation used the branch-built FE with an ASAN BE cache
(BE code is unchanged). A full local BE build was blocked while cloning a
required submodule.
- Manual SQL DDL covers top-level/nested required fields, NULL/default
rejection, MAP key rejection, older formats and failed-batch atomicity.
- Behavior changed:
- [ ] No.
- [x] Yes. Required v3 additions and nested scalar defaults are
supported; Boolean and SQL temporal defaults use their correct typed values.
- Does this need documentation?
- [ ] No.
- [x] Yes. Connector contract and examples are included in
`fe/fe-connector/docs/iceberg-add-column-defaults.md`.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]