shuwenwei opened a new pull request, #18394:
URL: https://github.com/apache/iotdb/pull/18394

   ## Description
   
   For wide aligned devices, a query that only touches a few columns currently
   clones the entire aligned TVList (all columns) in the working memtable, which
   is very expensive in both memory and time. This PR makes the query-side clone
   copy only the accessed columns and move the remaining uncloned columns by
   reference into the clone, so partial-column queries no longer duplicate the
   whole aligned device.
   
   ### Changes
   
   - `AlignedTVList`: add `clone(Set<Integer>)`, `cloneColumnDataTo` and
     `moveUnclonedColumnsTo` so the clone keeps only the accessed columns and 
the
     uncloned columns are transferred by reference into the new working list.
   - `ResourceByPathUtils.prepareTvListMapForQuery`: pass the accessed column
     index list into the clone path; re-fetch and re-verify the working TVList
     under the memChunk lock after acquiring its `queryListLock`, and perform
     clone + column move + working-list swap in the same memChunk critical
     section so a concurrent query never observes a detached list whose columns
     were already moved away.
   - `FragmentInstanceContext`: track column-level access for AlignedTVList.
   
   ### Tests
   
   - `AlignedTVListTest`: partial clone keeps only the accessed columns and 
moves
     the uncloned ones by reference.
   - `FragmentInstanceExecutionTest`: querying partial columns of an aligned
     device returns correct results.
   
   <hr>
   
   This PR has:
   - [x] been self-reviewed.
       - [ ] concurrent read
       - [ ] concurrent write
       - [x] concurrent read and write
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] added Javadocs for most classes and all non-trivial methods.
   - [ ] added or updated version, license, or notice information
   - [x] added comments explaining the "why" and the intent of the code 
wherever would not be obvious
   - [x] added unit tests or modified existing tests to cover new code paths
   - [ ] added integration tests.
   - [ ] been tested in a test IoTDB cluster.
   


-- 
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]

Reply via email to