DaZuiZui commented on issue #18636:
URL: https://github.com/apache/iotdb/issues/18636#issuecomment-5677438508

   Thanks for the report.
   
   This looks like a known IoTDB table-model window-function bug, not an issue 
with the SQL itself.
   
   The stack matches the old `TableWindowOperator` / `Partition` path:
   
   - `TableWindowOperator.next` builds a window partition
   - `PartitionExecutor` constructs `Partition(tsBlocks, 
startIndexInFirstBlock, endIndexInLastBlock)`
   - `TsBlock.getRegion(start, length)` then fails with `Invalid position 186 
and length -139 in page with 47 positions`
   
   That happens when `ROW_NUMBER() OVER (PARTITION BY date_bin(...))` splits 
data into many short partitions that cross TsBlock boundaries. The operator 
kept a stale `startIndexInFirstBlock` from a previous block (here `186`) and 
applied it to the next block (only `47` rows), so `length` became `47 - 186 = 
-139`.
   
   This was already fixed in https://github.com/apache/iotdb/pull/16809 (`Fix 
window partiton across two TsBlock bugs`) by resetting `startIndexInFirstBlock` 
after a complete partition is found.
   
   - **v2.0.7 and earlier**: can hit this stack
   - **v2.0.8+**: includes #16809
   - Later, https://github.com/apache/iotdb/pull/17280 rewrote this path to 
`PartitionRecognizer` + `PartitionCache`, so this `getRegion(186, -139)` 
slicing no longer exists on current master / 2.0.11-SNAPSHOT
   
   Could you share the exact IoTDB version? If you are on **2.0.7 or earlier**, 
upgrading to **2.0.8+** should avoid this crash. If it still happens on **2.0.8 
or later**, please add the version and a minimal repro and we can take another 
look.


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