Skip to content

[#12740] fix(doris): Preserve default value on column type change - #12747

Draft
jiangxt2 wants to merge 2 commits into
apache:mainfrom
jiangxt2:fix/doris-preserve-default-on-type-change
Draft

[#12740] fix(doris): Preserve default value on column type change#12747
jiangxt2 wants to merge 2 commits into
apache:mainfrom
jiangxt2:fix/doris-preserve-default-on-type-change

Conversation

@jiangxt2

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This pull request preserves the loaded Doris column default when TableChange.UpdateColumnType builds the replacement column definition. It also adds focused SQL-generation coverage for string, numeric, CURRENT_TIMESTAMP, explicit DEFAULT NULL, unset defaults, preserved column attributes, and nested-column rejection.

The integration coverage verifies successful default-preserving type changes on Doris 3.0.6.2 and 4.0.6, and verifies on Doris 4.0.6 that an unsupported VARCHAR to BOOLEAN conversion is still rejected without changing the column type or default.

This pull request is opened as a draft so it can be reviewed in parallel with a related Doris default-literal converter change. Before this draft is marked ready, it will be rebased onto that change, its string and numeric SQL expectations will be aligned with the merged Doris quoting rules, and an exact quote/backslash default-value case will be added and verified.

Why are the changes needed?

The Doris catalog currently replaces the existing default with DEFAULT_VALUE_NOT_SET when generating a MODIFY COLUMN statement for UpdateColumnType. Doris treats MODIFY COLUMN as a complete column definition and rejects the operation with Can not change default value when the submitted definition omits an existing default.

Preserving the loaded default makes the generated definition faithful to the unchanged column attributes while leaving type and default compatibility validation to Doris.

Fix: #12740

Does this PR introduce any user-facing change?

Yes. A supported Doris column type change can now preserve an existing default value instead of failing because the generated MODIFY COLUMN definition omits that default. This pull request does not change any public API or property key.

How was this patch tested?

  • ./gradlew :catalogs:catalog-jdbc-doris:spotlessCheck --console=plain --no-daemon
  • ./gradlew rat --console=plain --no-daemon
  • ./gradlew :catalogs:catalog-jdbc-doris:test -PskipITs --console=plain --no-daemon
  • ./gradlew :catalogs:catalog-jdbc-doris:build -x test --console=plain --no-daemon
  • Local static precheck covering negative-test consistency, string-slice safety, switch-case coverage, stale-comment references, orphan-test detection, commit-message validation, regex validation, cross-module impact, and unintended-file detection: all checks passed.
  • Doris 3.0.6.2: ./gradlew :catalogs:catalog-jdbc-doris:test --tests 'org.apache.gravitino.catalog.doris.integration.test.CatalogDoris3xIT.testAlterColumnTypePreservesDefaultValue' -PskipDockerTests=false -PdorisMultiVersionTest --console=plain --no-daemon
  • Doris 4.0.6: ./gradlew :catalogs:catalog-jdbc-doris:test --tests 'org.apache.gravitino.catalog.doris.integration.test.CatalogDoris4xIT.testAlterColumnTypePreservesDefaultValue' -PskipDockerTests=false -PdorisMultiVersionTest --console=plain --no-daemon
  • Doris 4.0.6: ./gradlew :catalogs:catalog-jdbc-doris:test --tests 'org.apache.gravitino.catalog.doris.integration.test.CatalogDoris4xIT.testAlterColumnTypeRejectsInvalidConversionWithDefaultValue' -PskipDockerTests=false -PdorisMultiVersionTest --console=plain --no-daemon

All listed checks and focused tests passed. The post-commit static precheck completed all nine checks successfully.

@jiangxt2

jiangxt2 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

PR #12747 will remain in draft until #12767 is merged. I will then rebase onto the updated main, remove the overlapping CREATE/read-path changes, keep this PR scoped to UpdateColumnType, rerun the affected Doris 3.0.6.2/4.0.6 tests, and mark it ready for review.

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.

[Bug report] Doris UpdateColumnType fails for columns with existing default values

1 participant