dsilletti opened a new issue, #17030:
URL: https://github.com/apache/iotdb/issues/17030

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/apache/iotdb/issues) and 
found nothing similar.
   
   
   ### Version
   
   IoTDB Version: 2.0.5 official docker container
   
   ### Describe the bug and provide the minimal reproduce step
   
   Description
   IoTDB incorrectly prunes partitions when querying time ranges, resulting in 
empty results for valid queries. The issue appears to be related to corrupted 
or incorrect partition metadata.
   
   Steps to Reproduce
   
   `IoTDB>SELECT Wh_in FROM root.electricity.measured.1m.REDC21620CDADC WHERE 
time >= 2026-01-01T00:00:00.000 AND time < 2026-01-08T00:00:00.000;
   +----+-------------------------------------------------+
   |Time|root.electricity.measured.1m.REDC21620CDADC.Wh_in|
   +----+-------------------------------------------------+
   +----+-------------------------------------------------+
   Empty set.
   It costs 0.004s` 
   
   
   ` IoTDB> SELECT Wh_in FROM root.electricity.measured.1m.REDC21620CDADC WHERE 
time >= 2026-01-01T00:00:00.000 AND time < 2026-01-09T00:00:00.000;
   +------------------------+-------------------------------------------------+
   |                    Time|root.electricity.measured.1m.REDC21620CDADC.Wh_in|
   +------------------------+-------------------------------------------------+
   |2026-01-01T00:00:00.000Z|                                        1.0756308|
   |2026-01-01T00:01:00.000Z|                                         1.081479|
   |2026-01-01T00:02:00.000Z|                                        1.0312717|
   |2026-01-01T00:03:00.000Z|                                        1.0825367|
   |2026-01-01T00:04:00.000Z|                                        0.9839263|
   |2026-01-01T00:05:00.000Z|                                        1.0742621|
   |2026-01-01T00:06:00.000Z|                                        1.0643699|
   |2026-01-01T00:07:00.000Z|                                        1.0771862|
   |2026-01-01T00:08:00.000Z|                                        1.0795504|
   |2026-01-01T00:09:00.000Z|                                        1.0848386|
   |2026-01-01T00:10:00.000Z|                                        1.0043327|
   |2026-01-01T00:11:00.000Z|                                        
1.0071946|` 
   
   
   ` IoTDB> explain SELECT Wh_in FROM 
root.electricity.measured.1m.REDC21620CDADC WHERE time >= 
2026-01-01T00:00:00.000 AND time < 2026-01-08T00:00:00.000;
   +-----------------------------------------------------------+
   |                                          distribution plan|
   +-----------------------------------------------------------+
   |┌─────────────────────────────────────────────────────────┐|
   |│SeriesScan-1                                             │|
   |│Series: root.electricity.measured.1m.REDC21620CDADC.Wh_in│|
   |│ScanOrder: ASC                                           │|
   |│Partition: Not Assigned                                  │|
   |└─────────────────────────────────────────────────────────┘|
   +-----------------------------------------------------------+
   Total line number = 6
   It costs 0.004s` 
   
   ` IoTDB> explain SELECT Wh_in FROM 
root.electricity.measured.1m.REDC21620CDADC WHERE time >= 
2026-01-01T00:00:00.000 AND time < 2026-01-09T00:00:00.000;
   +-----------------------------------------------------------+
   |                                          distribution plan|
   +-----------------------------------------------------------+
   |┌─────────────────────────────────────────────────────────┐|
   |│SeriesScan-1                                             │|
   |│Series: root.electricity.measured.1m.REDC21620CDADC.Wh_in│|
   |│ScanOrder: ASC                                           │|
   |│Partition: 4                                             │|
   |└─────────────────────────────────────────────────────────┘|
   +-----------------------------------------------------------+
   Total line number = 6
   It costs 0.005s
   IoTDB> ` 
   
   ### What did you expect to see?
   
   Expected Behavior
   Both queries should return the same data for the overlapping time range 
(2026-01-01 to 2026-01-07).
   
   
   
   ### What did you see instead?
   
   Actual Behavior
   Query with end time < 2026-01-09: Returns empty set
   
   Query with end time >= 2026-01-09: Returns correct data (including data  
with time < 2026-01-09) missing in the previous query
   
   ### Anything else?
   
   Root Cause Analysis
   The partition pruning logic appears to be incorrectly determining that no 
partitions contain data for certain time ranges, even though data exists. The 
issue seems to be:
   
   Partition metadata is corrupted or incorrectly calculated
   
   Query optimizer makes wrong decisions based on this metadata
   
   Different time range thresholds trigger different partition assignments
   
   This appears to be a critical bug affecting data retrieval reliability
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


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