Skip to content

Fix TS_2DIFF float/double page compatibility#796

Merged
jt2594838 merged 8 commits into
developfrom
fix/cpp-ts2diff
Jun 4, 2026
Merged

Fix TS_2DIFF float/double page compatibility#796
jt2594838 merged 8 commits into
developfrom
fix/cpp-ts2diff

Conversation

@hongzhi-gao
Copy link
Copy Markdown
Contributor

@hongzhi-gao hongzhi-gao commented Apr 30, 2026

Summary

  • Fix C++ TS_2DIFF float/double page layout to match Java overflow-page encoding.
  • Fix Java table-read time decoder selection to use actual time chunk encoding (instead of global default), preventing mis-decoding on PLAIN time chunks.
  • Harden googletest zip handling in CMake: reject/remove empty or invalid zip files and only accept valid ZIP magic before enabling tests.

Encoding Layout

Legacy raw block (old C++ path):
[ TS_2DIFF inner block ]

Java-compatible overflow page (fixed C++ path):
[ outer_magic(varint=2147483646) ]
[ count(varint) ]
[ bitmap_under ]
[ bitmap_over ]
[ inner_max_point(varint=2) ]
[ TS_2DIFF inner block payload ]

Test Input

Float values: 3.123456768E20f, NaN
Expected encoded hex (Java baseline):

FE FF FF FF 07 02 00 03 02 00 00 00 01 00 00 00 00 1E 38 8A AA 61 87 75 56

Verification

  • C++ encoded output matched the Java baseline byte-for-byte.
  • Java table query can read both C++-generated and Java-generated files

…idation.

Align C++ float/double TS_2DIFF flush/read behavior with Java overflow-page layout, and prevent 0-byte/corrupt googletest archives from being treated as successful downloads during test configuration.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 30, 2026

Codecov Report

❌ Patch coverage is 78.53659% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.58%. Comparing base (86ec4b9) to head (9ecdd9a).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
cpp/src/encoding/ts2diff_decoder.h 55.55% 36 Missing ⚠️
cpp/src/encoding/ts2diff_encoder.h 92.72% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #796      +/-   ##
===========================================
+ Coverage    61.49%   61.58%   +0.08%     
===========================================
  Files          731      731              
  Lines        45581    45874     +293     
  Branches      6787     6880      +93     
===========================================
+ Hits         28029    28250     +221     
- Misses       16560    16613      +53     
- Partials       992     1011      +19     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add optional TSFILE_OPTIMIZATION_FLAGS overrides in project/examples CMake while removing hardcoded optimization settings so library builds follow common CMake integration behavior.
Use Java-compatible default maxPoint handling for float/double TS_2DIFF encode/decode while preserving legacy raw-block compatibility, and add a byte-level regression test for the documented float/NaN hex sequence.
Use the actual time chunk encoding instead of global default when building time decoders in table read paths, preventing wrong TS_2DIFF decoding on PLAIN time chunks.
Drop nonessential explanatory comments in TS_2DIFF codec changes and remove unused defaultTimeDecoder from AbstractChunkReader to keep the PR focused for review.
Merge upstream/develop into fix/cpp-ts2diff and resolve CMake conflicts.
Use configured time encoding when reading non-time chunks, keep chunk
header encoding for aligned/table time chunks, and align test writers
with the encoders they use.
Mirror TestFloatJavaDefaultHexCompatibility with the same overflow-page
inputs so C++ double encoder output stays byte-for-byte compatible with Java.
Comment thread cpp/src/encoding/ts2diff_encoder.h Outdated
Comment on lines +541 to +544
constexpr uint32_t kJavaOverflowMagic =
2147483647u; // Integer.MAX_VALUE
constexpr uint32_t kJavaValueOverflowMagic =
2147483646u; // Integer.MAX_VALUE - 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kJavaOverflowMagic -> FLAG_SCALED_VALUE_OVERFLOW
kJavaValueOverflowMagic -> FLAG_ORIGINAL_VALUE_OVERFLOW

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed as suggested

Comment on lines +604 to +607
std::vector<uint8_t> underflow_bitmap(
static_cast<size_t>(num_values / 8 + 1), 0);
std::vector<uint8_t> value_overflow_bitmap(
static_cast<size_t>(num_values / 8 + 1), 0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May use overflow/underflow consistently.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Apply review feedback: FLAG_SCALED_VALUE_OVERFLOW /
FLAG_ORIGINAL_VALUE_OVERFLOW, and consistent underflow/overflow bitmap
names in encoder and decoder.
@jt2594838 jt2594838 merged commit 2a864c5 into develop Jun 4, 2026
38 checks passed
@jt2594838 jt2594838 deleted the fix/cpp-ts2diff branch June 4, 2026 08:47
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.

3 participants