Skip to content

Fix value and time chunk misalignment when rewriting with time deletion#719

Merged
JackieTien97 merged 1 commit intoapache:developfrom
shuwenwei:fixValueChunkRewrite
Feb 3, 2026
Merged

Fix value and time chunk misalignment when rewriting with time deletion#719
JackieTien97 merged 1 commit intoapache:developfrom
shuwenwei:fixValueChunkRewrite

Conversation

@shuwenwei
Copy link
Member

Background

When rewriting a value chunk to a new data type, the rewrite logic relies on
TableChunkReader to iterate over time-value pairs using the provided time
chunk and value chunk.

However, in the presence of time deletions, the original implementation
passed the original timeChunk directly into TableChunkReader. Since the
time chunk still contained deletion intervals, the filtered time sequence could
become inconsistent with the value chunk being rewritten.

Problem

With time deletions applied, the rewritten value chunk could contain points
that are not properly aligned with the corresponding timestamps in the time
chunk. This results in:

  • Incorrect time-value pairing
  • Inconsistent rewritten chunks
  • Potential query correctness issues after type modification

Solution

This PR fixes the issue by reconstructing a clean time chunk before rewrite:

  • A new Chunk is created from the original time chunk’s header, data,
    statistics, and encryption parameters
  • Deletion intervals are intentionally removed from the time chunk used by
    TableChunkReader
  • The rewrite process now iterates over fully aligned time-value pairs

This guarantees that the rewritten value chunk remains correctly aligned with
the time chunk, even when time deletions exist.

Impact

  • Ensures correctness when rewriting value chunks with a new data type
  • Fixes potential time-value misalignment caused by time deletions
  • No behavior change for cases without deletions

@JackieTien97 JackieTien97 merged commit 697df93 into apache:develop Feb 3, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants