Skip to content

[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
branch-1.3from
cherry-pick-3704b7a5-to-branch-1.3
Closed

[DO NOT MERGE] [Cherry-pick to branch-1.3] [#12736] fix(doris): validate ADD INDEX fields (#12737)#12753
github-actions[bot] wants to merge 1 commit into
branch-1.3from
cherry-pick-3704b7a5-to-branch-1.3

Conversation

@github-actions

Copy link
Copy Markdown

Cherry-pick Information:

  • Original commit: 3704b7a
  • Target branch: branch-1.3
  • Status: ⚠️ Has conflicts - manual resolution required

Do not merge until conflict markers are resolved and the
cherry-pick-conflict label is removed.

Please review and resolve the conflicts before merging.

### 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
@github-actions github-actions Bot added cherry-pick Automatically opened cherry-pick PR cherry-pick-conflict Cherry-pick has conflicts; needs human resolution before merge labels Aug 31, 2026
@github-actions
github-actions Bot requested a review from jerryshao August 31, 2026 13:25
@yuqi1129

Copy link
Copy Markdown
Contributor

@jiangxt2
Could you raise a PR for branch-1.3 manually? This PR needs to be closed as you can't update it.

@jiangxt2

jiangxt2 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

@jiangxt2 Could you raise a PR for branch-1.3 manually? This PR needs to be closed as you can't update it.

I opened #12762 to backport #12737 to branch-1.3 and resolved the conflict there.

@yuqi1129

yuqi1129 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Replaced by #12762

@yuqi1129 yuqi1129 closed this Sep 1, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick Automatically opened cherry-pick PR cherry-pick-conflict Cherry-pick has conflicts; needs human resolution before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants