Skip to content

fix: F16 columns (constant, dict, rle, sparse encodings; statistics Rust can read) - #517

Merged
dfa1 merged 4 commits into
mainfrom
fix/515-f16-encodings
Oct 10, 2026
Merged

dfa1 merged 4 commits into
mainfrom
fix/515-f16-encodings

Conversation

@dfa1

@dfa1 dfa1 commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Closes #515. Four commits, one per change, to be rebase-merged (not squashed):

  1. a4fba444 refactor: ConstantEncodingEncoder#constantBits replaces isConstant + readFirstRaw (first value read once, empty array explicit).
  2. 21ab5f5e fix: vortex.constant handles F16 (encoder + decoder; LazyConstantFloat16Array; the PType switches lose their default).
  3. 198d4607 fix: vortex.dict (reader rejected what the cascade wrote), fastlanes.rle (decoder) and vortex.sparse (encoder + decoder) handle F16 (DictFloat16Array, LazyRleFloat16Array, LazySparseFloat16Array).
  4. ce8dea70 fix: F16 min/max statistics are f16_value scalars. They were f32, which Rust rejects (expected F32 dtype for F32Value, got f16), so vortex-jni could not read any F16 file Java wrote. Adds Float16InteropIntegrationTest (28 cases against vortex-jni, both directions) and re-enables javaWriter_jniReader_f16_nanAndInf.

Verified locally: ./mvnw verify -pl integration -am (397 tests, 2 skipped) and ./mvnw test.

🤖 Generated with Claude Code

dfa1 and others added 4 commits October 10, 2026 16:09
ConstantEncodingEncoder#isConstant and #readFirstRaw each read element 0 (and, for
floats, converted it to raw bits) again; constantBits does both in one pass, with
the first value in a local outside the loop and the empty array an explicit early
return.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sko6B2519bE1TkpPx7WKxf
ConstantEncodingEncoder and ConstantEncodingDecoder had no F16 case, so a constant F16
column failed to write. The scalar is Rust's f16_value (the half bits as a u64); the
decoder also accepts the legacy uint64_value form. The ptype switches lose their
default branch, so a future PType fails to compile instead of at write time.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sko6B2519bE1TkpPx7WKxf
DictEncodingDecoder, DictLayoutDecoder and RleEncodingDecoder had no F16 case although
the cascade writes both encodings for F16, so such files could not be read back;
SparseEncodingEncoder and SparseEncodingDecoder had none at all. New DictFloat16Array,
LazyRleFloat16Array and LazySparseFloat16Array keep the 16 raw bits (a NaN payload or
-0.0 survives materialize) and ignore the pool's widened floats. Float16EncodingsRoundTripTest
writes eight data shapes under the default cascade and each of the four encodings forced,
and compares raw bits. The Rust interop test for F16 stays disabled (vortex-jni exports no F16).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sko6B2519bE1TkpPx7WKxf
PrimitiveEncodingEncoder wrote an F16 column's array-stat min/max as f32 scalars, which Rust
rejects (expected F32 dtype for F32Value, got f16), so vortex-jni could not read any F16 file
Java wrote. The scalars are now f16_value, as Rust types them, and the zone-map codec and the
reader's ArrayStats read that form. Float16InteropIntegrationTest checks both directions
against vortex-jni (Java writes/JNI reads with the default cascade and each of constant,
dict, rle and sparse forced; JNI writes/Java reads), comparing raw half bits; the old
disabled javaWriter_jniReader_f16_nanAndInf test passes and is enabled.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sko6B2519bE1TkpPx7WKxf
@dfa1
dfa1 force-pushed the fix/515-f16-encodings branch from 4f5c871 to ce8dea7 Compare October 10, 2026 14:43
@dfa1 dfa1 changed the title fix: F16 columns work in constant, dict, rle and sparse, and Rust can read their statistics fix: F16 columns (constant, dict, rle, sparse encodings; statistics Rust can read) Oct 10, 2026
@dfa1
dfa1 merged commit f71932c into main Oct 10, 2026
6 checks passed
dfa1 added a commit that referenced this pull request Oct 10, 2026
Eleven one-per-fix lines (#515, #517, #521) become a single F16 entry that lists the commits; the
Calcite F32 fix stays separate, being a different bug.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sko6B2519bE1TkpPx7WKxf
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.

F16 columns: constant, dict, rle and sparse encodings are unsupported

1 participant