shuwenwei opened a new pull request, #18819: URL: https://github.com/apache/iotdb/pull/18819
## Problem `failedMeasurementIndex2Info` maps a **column index** to the info of a measurement whose value failed partial-insert handling. When the insert columns are later reordered to match the schema's TAG order, this map is **not** updated: - `InsertBaseStatement.swapColumn(src, target)` swaps the measurement arrays but leaves the map keys untouched. - `InsertBaseStatement.rebuildArraysAfterExpansion(newToOldMapping, ...)` rebuilds the arrays from `newToOldMapping` but leaves the map keys untouched. The map therefore no longer describes the final `measurements` array. Any consumer that pairs the map with the arrays **by index** is then wrong, e.g.: - `LogicalPlanVisitor` marks the failed measurement on the `InsertRowNode` by the (stale) index. - `removeAllFailedMeasurementMarks()` restores the wrong column name / data type / value. - Downstream code that recovers a nulled column name from the map by index (e.g. write-label collection, `PipeConverted*Statement`) resolves the wrong column (or none). Note that `InsertBaseStatement.removeAttributeColumns()` already remaps `failedMeasurementIndex2Info` when it drops columns, so the missing remap in `swapColumn` / `rebuildArraysAfterExpansion` is an inconsistency in the same data structure. ## Fix - `swapColumn(src, target)` now swaps the two corresponding entries of `failedMeasurementIndex2Info`. - `rebuildArraysAfterExpansion(...)` now rewrites the map keys from the old indices to the new ones described by `newToOldMapping` (`newToOldMapping[newIdx] = oldIdx`); entries whose old index is `-1` (an appended missing TAG column) have no failure record and are naturally skipped. Both are additive, behavior-preserving for the non-reordered case (the map is empty or already aligned). ## Tests Added to `InsertStatementPartialInsertTest`: - `testSwapColumnRemapsFailedMeasurementIndex` - `testRebuildArraysAfterExpansionRemapsFailedMeasurementIndex` -- 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]
