Skip to content

branch-4.0: [Feature](iceberg) Support schema change for complex types in Iceberg external tables #60169#60993

Merged
yiguolei merged 6 commits intoapache:branch-4.0from
xylaaaaa:branch-4.0
Mar 3, 2026
Merged

branch-4.0: [Feature](iceberg) Support schema change for complex types in Iceberg external tables #60169#60993
yiguolei merged 6 commits intoapache:branch-4.0from
xylaaaaa:branch-4.0

Conversation

@xylaaaaa
Copy link
Contributor

@xylaaaaa xylaaaaa commented Mar 3, 2026

Summary

Source

Copilot AI review requested due to automatic review settings March 3, 2026 10:41
@xylaaaaa xylaaaaa requested a review from yiguolei as a code owner March 3, 2026 10:41
@Thearas
Copy link
Contributor

Thearas commented Mar 3, 2026

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@xylaaaaa
Copy link
Contributor Author

xylaaaaa commented Mar 3, 2026

run buildall

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Backports Iceberg complex-type ALTER TABLE ... MODIFY COLUMN validation enhancements into branch-4.0, adding stricter complex-type category checks and expanding nested-type promotion rules, with accompanying regression and unit tests.

Changes:

  • Add/extend FE-side validation and schema-update logic for modifying Iceberg complex columns (STRUCT/ARRAY/MAP), including category validation.
  • Expand nested primitive “safe promotion” rules used during complex-type schema-change validation.
  • Add new Iceberg complex-type regression coverage and FE unit tests; update existing test expectations/output.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
regression-test/suites/external_table_p0/iceberg/test_iceberg_schema_change_complex_types.groovy New regression suite covering allowed/prohibited complex-type modifications for Iceberg tables.
regression-test/suites/external_table_p0/iceberg/iceberg_schema_change_ddl.groovy Update expected exception message for primitive→complex modify behavior.
regression-test/data/external_table_p0/iceberg/iceberg_schema_change_ddl.out Update golden outputs (notably float/double textual rendering changes).
fe/fe-core/src/test/java/org/apache/doris/datasource/iceberg/IcebergMetadataOpsValidationTest.java New unit tests for Iceberg modify-column validation branches (primitive vs complex).
fe/fe-core/src/test/java/org/apache/doris/catalog/ColumnTest.java Adjust/extend array schema-change tests to reflect newly allowed promotions and rejected downgrades.
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.java Implement complex-type modify-column validation + schema updates (struct/list/map) and new error messages.
fe/fe-core/src/main/java/org/apache/doris/catalog/ColumnType.java Replace nested “char-only” allowance with broader nested safe-promotions for primitive types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 310 to 314
} else if (checkType.isMapType() && other.isMapType()) {
checkSupportSchemaChangeForComplexType(((MapType) checkType).getKeyType(),
((MapType) other).getKeyType(), true);
checkSupportSchemaChangeForComplexType(((MapType) checkType).getValueType(),
((MapType) other).getValueType(), true);
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

checkSupportSchemaChangeForComplexType now allows safe primitive promotions in nested types, and since MAP keys are validated via the same nested path, this would also allow changing MAP key type (e.g. INT→BIGINT) without throwing. MAP key type changes are generally unsafe (and this PR’s Iceberg path explicitly rejects them), so this method should special-case MAP to require key types be exactly equal (only allow promotions on the value type).

Copilot uses AI. Check for mistakes.
2 Bob 30 \N 87.2 \N
3 Charlie 22 \N 92.8 \N
4 David 28 123-456-7890 89.1 david@example.com
4 David 28 123-456-7890 89.09999999999999 david@example.com
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

This golden output now asserts exact textual rendering of floating-point values (e.g. 89.09999999999999), which tends to be backend/version-dependent and can make the regression test brittle. Consider adjusting the query/test to cast/round floating values to a stable representation (or avoid selecting raw FLOAT/DOUBLE in golden outputs) so the .out file remains deterministic and readable.

Suggested change
4 David 28 123-456-7890 89.09999999999999 david@example.com
4 David 28 123-456-7890 89.1 david@example.com

Copilot uses AI. Check for mistakes.
@morningman morningman changed the title [4.0] fix(iceberg): validate complex type category in column modify branch-4.0: [Feature](iceberg) Support schema change for complex types in Iceberg external tables #60169 Mar 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

PR approved by at least one committer and no changes requested.

@github-actions github-actions bot added approved Indicates a PR has been approved by one committer. reviewed labels Mar 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

PR approved by anyone and no changes requested.

@yiguolei yiguolei merged commit 8f31cee into apache:branch-4.0 Mar 3, 2026
30 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants