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

   ## Description
   
   ### Problem
   
   Table-model tag predicates are converted to OR-concatenated precise-filter 
branches. Both an IN predicate and its equivalent OR expression therefore 
produce multiple device patterns.
   
   When the predicate is on a non-leading tag and an earlier tag level is not 
fixed, every expanded pattern traverses the same wildcard prefix independently. 
With N values, the schema tree prefix is visited N times. Rewriting IN as OR 
does not avoid this behavior.
   
   ### Solution
   
   - Keep predicate expansion in the relational planner so complete device IDs 
can still benefit from the existing device cache and partition lookup paths.
   - Compact branches in DeviceFilterUtil only when they differ by a precise 
value at a non-leading tag behind an unfixed earlier tag level.
   - Represent the merged values as an InFilter attached to ExtendedPartialPath.
   - Add multi-exact transitions to SimpleNFA. The schema traverser visits the 
wildcard prefix once, then directly looks up only the requested child names 
instead of enumerating every child at that level.
   
   Leading-tag predicates and fully fixed prefixes remain as separate precise 
paths. Branches with null precise values, additional filters on the same tag, 
or correlated conditions such as (card = a AND device = x) OR (card = b AND 
device = y) are not merged.
   
   For the motivating case, six values on the second tag are reduced from six 
schema readers over the same first-tag wildcard subtree to one reader with six 
precise transitions.
   
   ### Tests
   
   - DeviceFilterUtilTest: 7 tests passed
   - SchemaPredicateUtilTest: 2 tests passed, covering both expanded IN and 
equivalent OR
   - SchemaRegionTableDeviceTest: 20 tests passed
   - Spotless, Checkstyle, and git diff checks passed
   
   <hr>
   
   This PR has:
   - [x] been self-reviewed.
   - [x] added comments explaining the intent of the optimization.
   - [x] added unit tests covering the new code paths and safety guards.
   
   <hr>
   
   ##### Key changed/added classes
   
   - DeviceFilterUtil
   - ExtendedPartialPath
   - SimpleNFA
   - DeviceFilterUtilTest
   - SchemaPredicateUtilTest


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