danny0405 opened a new pull request, #20340:
URL: https://github.com/apache/hudi/pull/20340

   ### Describe the issue this Pull Request addresses
   
   Following #20273, `CompletionTimeQueryViewV2.isArchived()` excludes 
savepointed instants but still classifies active clean/rollback instants before 
the first non-savepointed write as archived. If their completion times fall in 
an incremental query's range, `IncrementalQueryAnalyzer` unnecessarily loads 
the archived timeline. This can occur even when archival beyond savepoints is 
disabled.
   
   ### Summary and Changelog
   
   Use membership in the meta client's cached active timeline to exclude all 
active instants from archive classification.
   
   - Replace the separate savepoint timestamp set with 
`getActiveTimeline().containsInstant()` while preserving the existing write 
boundary and lazy-loading cursor.
   - Clarify that tables upgraded from pre-v8 can have interleaved archived and 
active instants.
   - Extend existing tests with clean/rollback cases, with and without 
savepoints, verifying that incremental queries avoid archive lookups and that 
archived writes remain readable around older active instants.
   
   No code was copied from external projects.
   
   ### Impact
   
   Avoids unnecessary archived-timeline initialization and manifest lookup for 
incremental queries containing active clean/rollback completion times. When 
those instants are newer than all archived files, existing filename-range 
filtering already skips the Parquet files, so the benefit is limited to setup 
and metadata overhead. Older interleaved active instants can overlap archive 
file ranges. The membership check reuses the cached active timeline and adds no 
storage I/O. No public API, configuration, or storage-format changes.
   
   ### Risk Level
   
   low
   
   The change is limited to archive classification in the V2 completion-time 
query view. The existing cursor and archive-loading behavior are preserved. All 
21 targeted tests passed across `TestIncrementalQueryAnalyzer`, 
`TestCompletionTimeQueryView`, and `TestCompletionTimeQueryViewV1`, including 
savepoint and interleaving coverage.
   
   Validation used Java 17 with the Byte Buddy agent preloaded:
   
   ```sh
   mvn -o -pl hudi-client/hudi-client-common -am test \
     
-Dtest=TestCompletionTimeQueryView,TestCompletionTimeQueryViewV1,TestIncrementalQueryAnalyzer
 \
     -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false \
     -DskipITs -DskipFTs -Drat.skip=true
   ```
   
   Integration/functional test suites and RAT were not run. `git diff --check` 
passed.
   
   ### Documentation Update
   
   none — internal query optimization with no new feature or configuration. The 
constructor comment explains the pre-v8 upgrade case.
   
   ### Contributor's checklist
   
   - [x] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Enough context is provided in the sections above
   - [x] Adequate tests were added if applicable
   


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