This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.2
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.2 by this push:
new b2ff463a868 branch-4.2: [fix](inverted index) Match shadow index
columns during schema change (#57006) (#68636)
b2ff463a868 is described below
commit b2ff463a8685d4964067f49b48e1b8d2199e216a
Author: Jack <[email protected]>
AuthorDate: Tue Sep 29 17:27:58 2026 +0800
branch-4.2: [fix](inverted index) Match shadow index columns during schema
change (#57006) (#68636)
### What problem does this PR solve?
Issue Number: None
Related PR: https://github.com/apache/doris/pull/57006
Problem Summary:
During schema change, an indexed column may have a shadow prefix in the
working schema. `Index.getColumnUniqueIds()` previously compared that
temporary name with the original index column name, so the index column
ID could be omitted from the new tablet metadata. This PR separately
backports the master fix to `branch-4.2` and adds a focused FE test. It
does not include the SNII or gram-index backports.
Source commit: `5f0a8c68ded9933b1ea7df709cdf1322bad48dea` (#57006).
Backport commits: `8fde58aa539` (cherry-pick with `-x`) and
`197b6e46c9b` (test).
| Source PR hunk | Result on `branch-4.2` |
| --- | --- |
| `fe/fe-core/src/main/java/org/apache/doris/catalog/Index.java` `@@
-283,7 +283,9` | Ported: compare the original index column name with
`Column.removeNamePrefix(column.getName())`, preserving case-insensitive
matching. |
`git range-diff` maps the source commit to `8fde58aa539`; the source
code change is unchanged. The picked commit adds the `-x` provenance
line, and the separate test commit has no source PR counterpart.
Validation:
- `./build.sh --fe`: passed; Checkstyle reported zero violations.
- `./run-fe-ut.sh --run org.apache.doris.catalog.IndexTest`: 2 tests
passed, including the new shadow-column case.
- `test_index_ddl_fault_injection` on an isolated cloud cluster: 1 suite
passed, 0 failed. The FE was built from this PR; the BE came from a
local branch-4.2 SNII/gram backport build. The isolated BE had debug
points enabled, as required by this existing suite.
- Full PR English check against `origin/branch-4.2`: passed with no
exceptions.
- Full merged-tree FE Checkstyle preflight: passed.
### Release note
None
### Check List (For Author)
- Test
- [x] Regression test
- [x] Unit Test
- [ ] Manual test
- [ ] No need to test or manual test
- Behavior changed:
- [ ] No.
- [x] Yes. Index column IDs are retained when schema change uses shadow
column names; no protocol or on-disk format changes.
- Does this need documentation?
- [x] No.
- [ ] Yes.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
---------
Co-authored-by: zzzxl <[email protected]>
---
fe/fe-core/src/main/java/org/apache/doris/catalog/Index.java | 4 +++-
.../src/test/java/org/apache/doris/catalog/IndexTest.java | 12 ++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Index.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Index.java
index 352f89c7959..ce7acb77bc4 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Index.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Index.java
@@ -287,7 +287,9 @@ public class Index implements Writable {
if (schema != null) {
for (String columnName : columns) {
for (Column column : schema) {
- if (columnName.equalsIgnoreCase(column.getName())) {
+ // Remove shadow prefix when comparing to handle schema
change scenarios
+ if (columnName.equalsIgnoreCase(
+ Column.removeNamePrefix(column.getName()))) {
columnUniqueIds.add(column.getUniqueId());
}
}
diff --git a/fe/fe-core/src/test/java/org/apache/doris/catalog/IndexTest.java
b/fe/fe-core/src/test/java/org/apache/doris/catalog/IndexTest.java
index 776c97ca76b..411930e1092 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/catalog/IndexTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/IndexTest.java
@@ -23,10 +23,22 @@ import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
public class IndexTest {
+ @Test
+ public void testGetColumnUniqueIdsForShadowColumn() {
+ Column shadowColumn = new Column(Column.getShadowName("MiXeD_CaSe"),
Type.STRING);
+ shadowColumn.setUniqueId(107);
+ Index index = new Index(12, "shadow_index",
Collections.singletonList("mixed_case"),
+ IndexDef.IndexType.INVERTED, null, null);
+
+ Assert.assertEquals(Collections.singletonList(107),
+
index.getColumnUniqueIds(Collections.singletonList(shadowColumn)));
+ }
+
@Test
public void testGetColumnUniqueIds() {
// Create test columns with unique IDs
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]