You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "shuwenwei (via GitHub)" <gi...@apache.org> on 2026/10/10 10:50:20 UTC

[PR] [Fix] Remap failed-measurement indices when reordering insert columns [iotdb]

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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix] Remap failed-measurement indices when reordering insert columns [iotdb]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #18819:
URL: https://github.com/apache/iotdb/pull/18819#issuecomment-6097123982

   ## [Codecov](https://app.codecov.io/gh/apache/iotdb/pull/18819?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `95.83333%` with `1 line` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 45.82%. Comparing base ([`f16e5b3`](https://app.codecov.io/gh/apache/iotdb/commit/f16e5b36fb564e3f572012c89f4a8d43c6e6246d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`ad48b58`](https://app.codecov.io/gh/apache/iotdb/commit/ad48b58169b00345814cbdff44c77cf158508a59?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/iotdb/pull/18819?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...ngine/plan/statement/crud/InsertBaseStatement.java](https://app.codecov.io/gh/apache/iotdb/pull/18819?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Fstatement%2Fcrud%2FInsertBaseStatement.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9zdGF0ZW1lbnQvY3J1ZC9JbnNlcnRCYXNlU3RhdGVtZW50LmphdmE=) | 95.83% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/18819?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #18819      +/-   ##
   ============================================
   - Coverage     45.82%   45.82%   -0.01%     
     Complexity      712      712              
   ============================================
     Files          5498     5498              
     Lines        397637   397661      +24     
     Branches      51765    51770       +5     
   ============================================
   - Hits         182235   182231       -4     
   - Misses       215402   215430      +28     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/iotdb/pull/18819?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   </details>


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix] Remap failed-measurement indices when reordering insert columns [iotdb]

Posted by "JackieTien97 (via GitHub)" <gi...@apache.org>.
JackieTien97 merged PR #18819:
URL: https://github.com/apache/iotdb/pull/18819


-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org