[DO NOT MERGE] [Cherry-pick to branch-1.3] [#12736] fix(doris): validate ADD INDEX fields (#12737) - #12753
Closed
github-actions[bot] wants to merge 1 commit into
Closed
Conversation
### What changes were proposed in this pull request? This pull request adds a Doris-specific field-shape validator shared by CREATE TABLE index generation and ALTER TABLE ADD INDEX. The validator requires exactly one non-blank top-level field and returns that validated field for SQL generation. It also adds focused tests for valid index SQL, malformed field shapes, consistent CREATE and ALTER validation, the no-JDBC-statement failure path, and the real Doris 4.x ADD/DROP INDEX lifecycle. ### Why are the changes needed? The Doris ALTER ADD INDEX path currently reads only `getFieldNames()[0][0]`. When a request contains multiple fields or a nested field path, Gravitino silently discards the remaining components and can create a valid single-column Doris index that does not match the request. Rejecting unsupported field shapes before DDL generation prevents this semantic truncation and makes CREATE and ALTER enforce the same Doris connector contract. Valid single-field index SQL and existing key-model behavior remain unchanged. Fix: #12736 ### Does this PR introduce _any_ user-facing change? Yes. Doris CREATE TABLE and ALTER TABLE ADD INDEX requests containing multiple fields, nested field paths, empty field shapes, or blank field names now fail with an explicit `IllegalArgumentException` instead of being truncated or producing invalid SQL. Valid single-field index operations are unchanged, and no public API or property key is added or removed. ### How was this patch tested? - `./gradlew :catalogs:catalog-jdbc-doris:spotlessCheck` - `./gradlew rat` - `./gradlew :catalogs:catalog-jdbc-doris:test -PskipITs` - `./gradlew :catalogs:catalog-jdbc-doris:test --tests 'org.apache.gravitino.catalog.doris.integration.test.CatalogDoris4xIT.testAddAndDropInvertedIndex' -PskipDockerTests=false -PdorisMultiVersionTest` - `./gradlew :catalogs:catalog-jdbc-doris:build -x test` Signed-off-by: jiangxt2 <jiangxt2@vip.qq.com> # Conflicts: # catalogs/catalog-jdbc-doris/src/test/java/org/apache/gravitino/catalog/doris/integration/test/CatalogDoris4xIT.java
Contributor
|
@jiangxt2 |
Contributor
Contributor
|
Replaced by #12762 |
yuqi1129
pushed a commit
that referenced
this pull request
Sep 3, 2026
…ields (#12737) (#12762) **Cherry-pick Information:** - Original commit: `3704b7a5bfe978421e43d53d5472f6c52bc15073` - Original PR: #12737 - Target branch: `branch-1.3` - Status: ✅ Conflict resolved manually in the `CatalogDoris4xIT` assertion imports - Replaces: #12753 ### What changes were proposed in this pull request? This pull request manually backports #12737 to `branch-1.3`. It preserves the shared Doris CREATE/ALTER index field-shape validation and its focused unit and Doris 4.x integration coverage. ### Why are the changes needed? The automated cherry-pick PR #12753 contains unresolved conflict markers in `CatalogDoris4xIT` and cannot be updated from the contributor's fork. This PR resolves that conflict while preserving the original fix. Fix: #12736 ### Does this PR introduce _any_ user-facing change? Yes. Doris CREATE TABLE and ALTER TABLE ADD INDEX requests containing multiple fields, nested field paths, empty field shapes, or blank field names now fail with an explicit `IllegalArgumentException` instead of being truncated or producing invalid SQL. Valid single-field index operations are unchanged, and no public API or property key is added or removed. ### How was this patch tested? - `./gradlew :catalogs:catalog-jdbc-doris:spotlessCheck` - `./gradlew rat` - `./gradlew :catalogs:catalog-jdbc-doris:test --tests 'org.apache.gravitino.catalog.doris.operation.TestDorisTableOperationsSqlGeneration' -PskipITs` - `./gradlew :catalogs:catalog-jdbc-doris:test --tests 'org.apache.gravitino.catalog.doris.integration.test.CatalogDoris4xIT.testAddAndDropInvertedIndex' -PskipDockerTests=false -PdorisMultiVersionTest` (1 test, 0 skipped, 0 failures, 0 errors) - `./gradlew :catalogs:catalog-jdbc-doris:build -x test` Signed-off-by: jiangxt2 <jiangxt2@vip.qq.com>
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.
Cherry-pick Information:
branch-1.3Do not merge until conflict markers are resolved and the
cherry-pick-conflictlabel is removed.Please review and resolve the conflicts before merging.