hongzhi-gao opened a new pull request, #784:
URL: https://github.com/apache/tsfile/pull/784

   ### 背景
   在表模型恢复写入场景中,如果首轮写入存在一段 TAG 全空值(如 null.null.null 设备组),随后执行文件尾损坏恢复并继续写入,会出现 
FLOAT/DOUBLE 元数据统计异常。
   预期这类全空值组的统计应为 count=0, start_time=0, end_time=0。
   
   **根因**
   RestorableTsFileIOWriter 在恢复 aligned value chunk 统计时,未结合 value page 的 
null-bitmap 过滤空值位置,导致空值位也被错误参与统计更新。
   
   **修复内容**
   修改 cpp/src/file/restorable_tsfile_io_writer.cc
   在恢复 aligned value page 时解析 num_values + null-bitmap
   按 bitmap 判断当前时间位是否有值,仅对非空位执行 value 解码和统计更新
   
   ## English Version
   
   ### Background
   In the table-model recovery write path, if the first write contains a 
segment where all TAG columns are null (for example, the `null.null.null` 
device group), and the file tail is then corrupted and recovered before 
continuing writes, the `FLOAT`/`DOUBLE` metadata statistics can become 
incorrect.  
   For such all-null groups, the expected statistics are: `count=0`, 
`start_time=0`, `end_time=0`.
   
   ### Why
   When `RestorableTsFileIOWriter` rebuilds statistics for aligned value chunks 
during recovery, it does not use the value-page null bitmap to filter null 
positions. As a result, null positions are incorrectly included in statistic 
updates.
   
   ### Fix
   Updated `cpp/src/file/restorable_tsfile_io_writer.cc`:
   - Parse `num_values` and the null bitmap when recovering aligned value pages.
   - Use the bitmap to determine whether each timestamp position actually has a 
value.
   - Decode values and update statistics **only** for non-null positions.


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