Skip to content

Commit f2d7435

Browse files
dfa1claude
andcommitted
test(integration): Rust reads Java-written vortex.stats zone-map
Multi-chunk file written with enableZoneMaps (one zone per chunk) is read back via the Rust JNI reader; all values round-trip, proving the Java-emitted vortex.stats layout is Rust-compatible. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 0713293 commit f2d7435

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

integration/src/test/java/io/github/dfa1/vortex/integration/JavaWritesRustReadsIntegrationTest.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,37 @@ void javaWriter_jniReader_multipleChunks(@TempDir Path tmp) throws IOException {
495495
assertThat(decodedIds).containsExactly(1L, 2L, 3L, 4L, 5L);
496496
}
497497

498+
@Test
499+
void javaWriter_jniReader_zoneMapped_multipleZones(@TempDir Path tmp) throws IOException {
500+
// Given — a small chunkSize forces several chunks, so the writer emits a vortex.stats
501+
// zone-map with one zone per chunk. The Rust reader must parse that layout and still
502+
// return every value (zones are a transparent pruning aux).
503+
Path file = tmp.resolve("java_zoned.vtx");
504+
WriteOptions zoneMapped = new WriteOptions(4, true, 0.90, 0, true, false);
505+
long[] ids = new long[20];
506+
double[] vals = new double[20];
507+
for (int i = 0; i < 20; i++) {
508+
ids[i] = i;
509+
vals[i] = i * 0.5;
510+
}
511+
try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE);
512+
var sut = VortexWriter.create(ch, SCHEMA, zoneMapped)) {
513+
for (int start = 0; start < 20; start += 4) {
514+
sut.writeChunk(Map.of(
515+
"id", Arrays.copyOfRange(ids, start, start + 4),
516+
"value", Arrays.copyOfRange(vals, start, start + 4)));
517+
}
518+
}
519+
520+
// When
521+
long[] decodedIds = readLongColumn(file, "id");
522+
double[] decodedVals = readDoubleColumn(file, "value");
523+
524+
// Then — all rows survive the Java zone-map -> Rust read round-trip
525+
assertThat(decodedIds).containsExactly(ids);
526+
assertThat(decodedVals).containsExactly(vals);
527+
}
528+
498529
@Test
499530
void javaWriter_jniReader_i32Column(@TempDir Path tmp) throws IOException {
500531
// Given

0 commit comments

Comments
 (0)