[#12740] fix(doris): Preserve default value on column type change - #12747
Draft
jiangxt2 wants to merge 2 commits into
Draft
[#12740] fix(doris): Preserve default value on column type change#12747jiangxt2 wants to merge 2 commits into
jiangxt2 wants to merge 2 commits into
Conversation
Signed-off-by: jiangxt2 <jiangxt2@vip.qq.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This pull request preserves the loaded Doris column default when
TableChange.UpdateColumnTypebuilds the replacement column definition. It also adds focused SQL-generation coverage for string, numeric,CURRENT_TIMESTAMP, explicitDEFAULT 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
VARCHARtoBOOLEANconversion 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_SETwhen generating aMODIFY COLUMNstatement forUpdateColumnType. Doris treatsMODIFY COLUMNas a complete column definition and rejects the operation withCan not change default valuewhen 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 COLUMNdefinition 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./gradlew :catalogs:catalog-jdbc-doris:test --tests 'org.apache.gravitino.catalog.doris.integration.test.CatalogDoris3xIT.testAlterColumnTypePreservesDefaultValue' -PskipDockerTests=false -PdorisMultiVersionTest --console=plain --no-daemon./gradlew :catalogs:catalog-jdbc-doris:test --tests 'org.apache.gravitino.catalog.doris.integration.test.CatalogDoris4xIT.testAlterColumnTypePreservesDefaultValue' -PskipDockerTests=false -PdorisMultiVersionTest --console=plain --no-daemon./gradlew :catalogs:catalog-jdbc-doris:test --tests 'org.apache.gravitino.catalog.doris.integration.test.CatalogDoris4xIT.testAlterColumnTypeRejectsInvalidConversionWithDefaultValue' -PskipDockerTests=false -PdorisMultiVersionTest --console=plain --no-daemonAll listed checks and focused tests passed. The post-commit static precheck completed all nine checks successfully.