github-actions[bot] commented on code in PR #69445:
URL: https://github.com/apache/doris/pull/69445#discussion_r4345815045


##########
fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java:
##########
@@ -2376,8 +2381,13 @@ public int getAsInt() {
             Map<Long, Set<String>> indexOnPartitions = new HashMap<>();
             boolean isDropIndex = false;
             Map<String, String> propertyMap = new HashMap<>();
-            Map<String, List<String>> sequenceMapping = 
olapTable.getColumnSeqMapping() == null ? new HashMap<>()
-                    : new HashMap<>(olapTable.getColumnSeqMapping());
+            // Copy the column groups too: processDropSequenceMapping removes 
columns from them, and the table's
+            // mapping must only change through the schema change job.
+            Map<String, List<String>> sequenceMapping = new HashMap<>();
+            if (olapTable.getColumnSeqMapping() != null) {
+                olapTable.getColumnSeqMapping().forEach(
+                        (seqColumn, columnGroup) -> 
sequenceMapping.put(seqColumn, new ArrayList<>(columnGroup)));

Review Comment:
   [P2] Preserve the copied sequence mapping on light index changes
   
   On a local UNIQUE table with `sequence_mapping.s1='c,d'` and light index 
changes enabled, `ALTER TABLE t DROP COLUMN c, DROP COLUMN d, ADD INDEX 
idx_k1(k1) USING INVERTED` takes the light-index branch: the drops set 
`lightSchemaChange=false`, but the add sets `lightIndexChange=true`. 
`modifyTableLightSchemaChange` publishes the column removals without receiving 
`sequenceMapping`, so this new deep copy leaves the live group as `[c,d]` even 
though both columns are gone. A subsequent `DROP COLUMN s1` then fails with 
"Can not drop sequence column that has column group"; the previous shallow copy 
removed those names from the live group. Keep the isolated copy, but route 
mapping changes through `createJob` or explicitly publish and persist that 
mapping in the light path too. Please cover this successful mixed statement in 
a regression test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to