diff --git a/calcite/src/test/java/io/github/dfa1/vortex/calcite/AggregateSumNullTest.java b/calcite/src/test/java/io/github/dfa1/vortex/calcite/AggregateSumNullTest.java index 59c937d2..72326a46 100644 --- a/calcite/src/test/java/io/github/dfa1/vortex/calcite/AggregateSumNullTest.java +++ b/calcite/src/test/java/io/github/dfa1/vortex/calcite/AggregateSumNullTest.java @@ -52,7 +52,7 @@ private SchemaPlus tableOf(long[] values, boolean[] valid) throws IOException { WriteOptions opts = new WriteOptions(1024, true, 0.90, 0, false, false); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var writer = VortexWriter.create(ch, schema, opts)) { - writer.writeChunk(Map.of("v", new NullableData(values, valid))); + writer.writeChunk(Map.of(ColumnName.of("v"), new NullableData(values, valid))); } SchemaPlus root = Frameworks.createRootSchema(true); return root.add("vtx", new VortexSchema(Map.of("t", file))); diff --git a/calcite/src/test/java/io/github/dfa1/vortex/calcite/AggregateWhereBoundaryTest.java b/calcite/src/test/java/io/github/dfa1/vortex/calcite/AggregateWhereBoundaryTest.java index e3e0204a..cac3969f 100644 --- a/calcite/src/test/java/io/github/dfa1/vortex/calcite/AggregateWhereBoundaryTest.java +++ b/calcite/src/test/java/io/github/dfa1/vortex/calcite/AggregateWhereBoundaryTest.java @@ -68,7 +68,7 @@ static void write() throws Exception { id[i] = v; val[i] = v; } - writer.writeChunk(Map.of("id", id, "val", val)); + writer.writeChunk(Map.of(ColumnName.of("id"), id, ColumnName.of("val"), val)); } } } @@ -207,10 +207,10 @@ void nullableAggColumnAcrossBoundaryChunk() throws Exception { false); Path f = tmp.resolve("nullable-boundary.vortex"); writeChunks(f, schema, - Map.of("id", new long[]{0, 1, 2, 3}, - "val", new NullableData(new long[]{10, 0, 30, 0}, new boolean[]{true, false, true, false})), - Map.of("id", new long[]{10, 11, 12, 13}, - "val", new NullableData(new long[]{1, 2, 3, 4}, new boolean[]{true, true, true, true}))); + Map.of(ColumnName.of("id"), new long[]{0, 1, 2, 3}, + ColumnName.of("val"), new NullableData(new long[]{10, 0, 30, 0}, new boolean[]{true, false, true, false})), + Map.of(ColumnName.of("id"), new long[]{10, 11, 12, 13}, + ColumnName.of("val"), new NullableData(new long[]{1, 2, 3, 4}, new boolean[]{true, true, true, true}))); try (Connection conn = connect(f)) { // When the aggregates are taken — the boundary chunk is decoded and folded, no full scan @@ -244,8 +244,8 @@ void nonNumericMinAcrossBoundaryAbandonsButScanIsCorrect() throws Exception { false); Path f = tmp.resolve("strmin-boundary.vortex"); writeChunks(f, schema, - Map.of("id", new long[]{0, 1, 2, 3}, "name", new String[]{"a", "b", "c", "d"}), - Map.of("id", new long[]{10, 11, 12, 13}, "name", new String[]{"e", "f", "g", "h"})); + Map.of(ColumnName.of("id"), new long[]{0, 1, 2, 3}, ColumnName.of("name"), new String[]{"a", "b", "c", "d"}), + Map.of(ColumnName.of("id"), new long[]{10, 11, 12, 13}, ColumnName.of("name"), new String[]{"e", "f", "g", "h"})); try (Connection conn = connect(f)) { // When MIN over the string column is taken across the boundary — the rewrite abandons, so @@ -273,8 +273,8 @@ void unsignedKeyAcrossBoundaryAbandonsButScanIsCorrect() throws Exception { false); Path f = tmp.resolve("u64-boundary.vortex"); writeChunks(f, schema, - Map.of("id", new long[]{0, 1, 2, 3}, "val", new long[]{0, 1, 2, 3}), - Map.of("id", new long[]{10, 11, 12, 13}, "val", new long[]{10, 11, 12, 13})); + Map.of(ColumnName.of("id"), new long[]{0, 1, 2, 3}, ColumnName.of("val"), new long[]{0, 1, 2, 3}), + Map.of(ColumnName.of("id"), new long[]{10, 11, 12, 13}, ColumnName.of("val"), new long[]{10, 11, 12, 13})); try (Connection conn = connect(f)) { // When the aggregate spans the unsigned key across a boundary — a scan remains in the plan @@ -340,10 +340,10 @@ void neqWithNullInFilterColumnAcrossBoundaryExcludesNullAndValue() throws Except false); Path f = tmp.resolve("neq-null-boundary.vortex"); writeChunks(f, schema, - Map.of("id", new long[]{0, 1, 2, 3}, - "amt", new NullableData(new long[]{10, 0, 30, 40}, new boolean[]{true, false, true, true})), - Map.of("id", new long[]{10, 11, 12, 13}, - "amt", new NullableData(new long[]{50, 60, 70, 80}, new boolean[]{true, true, true, true}))); + Map.of(ColumnName.of("id"), new long[]{0, 1, 2, 3}, + ColumnName.of("amt"), new NullableData(new long[]{10, 0, 30, 40}, new boolean[]{true, false, true, true})), + Map.of(ColumnName.of("id"), new long[]{10, 11, 12, 13}, + ColumnName.of("amt"), new NullableData(new long[]{50, 60, 70, 80}, new boolean[]{true, true, true, true}))); // Ground truth: reduce the same data, dropping the null row (UNKNOWN) and the amt == 30 row. long[] allAmt = {10, 0, 30, 40, 50, 60, 70, 80}; @@ -391,8 +391,8 @@ void floatFilterColumnAcrossBoundaryAbandonsButScanIsNaNCorrect() throws Excepti false); Path f = tmp.resolve("float-nan-boundary.vortex"); writeChunks(f, schema, - Map.of("f", new double[]{1.0, Double.NaN, 2.0, 3.0}, "val", new long[]{10, 20, 30, 40}), - Map.of("f", new double[]{4.0, 5.0, 6.0, 7.0}, "val", new long[]{50, 60, 70, 80})); + Map.of(ColumnName.of("f"), new double[]{1.0, Double.NaN, 2.0, 3.0}, ColumnName.of("val"), new long[]{10, 20, 30, 40}), + Map.of(ColumnName.of("f"), new double[]{4.0, 5.0, 6.0, 7.0}, ColumnName.of("val"), new long[]{50, 60, 70, 80})); // Ground truth: reduce the same data with SQL-NaN-correct `f >= 1.5` (NaN row excluded). double[] allF = {1.0, Double.NaN, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0}; @@ -453,8 +453,8 @@ private static Ground reduce(java.util.function.LongPredicate predicate) { return new Ground(sum, count, min, max); } - private static void writeChunks(Path file, DType.Struct schema, Map chunk0, - Map chunk1) throws Exception { + private static void writeChunks(Path file, DType.Struct schema, Map chunk0, + Map chunk1) throws Exception { // chunkSize large so each writeChunk is exactly one chunk (one zone). WriteOptions opts = new WriteOptions(1024, true, 0.90, 0, false, false); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); diff --git a/calcite/src/test/java/io/github/dfa1/vortex/calcite/AggregateWhereCleanPartitionTest.java b/calcite/src/test/java/io/github/dfa1/vortex/calcite/AggregateWhereCleanPartitionTest.java index c8bcb30b..cf34615f 100644 --- a/calcite/src/test/java/io/github/dfa1/vortex/calcite/AggregateWhereCleanPartitionTest.java +++ b/calcite/src/test/java/io/github/dfa1/vortex/calcite/AggregateWhereCleanPartitionTest.java @@ -67,7 +67,7 @@ static void write() throws Exception { id[i] = v; val[i] = v; } - writer.writeChunk(Map.of("id", id, "val", val)); + writer.writeChunk(Map.of(ColumnName.of("id"), id, ColumnName.of("val"), val)); } } } @@ -161,8 +161,8 @@ void narrowIntegerKeyFoldsFromStats() throws Exception { false); Path f = tmp.resolve("i32.vortex"); writeChunks(f, schema, - Map.of("id", new int[]{0, 1, 2, 3}, "val", new int[]{0, 1, 2, 3}), - Map.of("id", new int[]{10, 11, 12, 13}, "val", new int[]{10, 11, 12, 13})); + Map.of(ColumnName.of("id"), new int[]{0, 1, 2, 3}, ColumnName.of("val"), new int[]{0, 1, 2, 3}), + Map.of(ColumnName.of("id"), new int[]{10, 11, 12, 13}, ColumnName.of("val"), new int[]{10, 11, 12, 13})); try (Connection conn = connect(f)) { // When the first chunk is selected (id < 10), the aggregates fold from stats — no scan @@ -191,10 +191,10 @@ void nullAwareSumAndCountOverKeptZones() throws Exception { false); Path f = tmp.resolve("nullable.vortex"); writeChunks(f, schema, - Map.of("id", new long[]{0, 1, 2, 3}, - "val", new NullableData(new long[]{10, 0, 30, 0}, new boolean[]{true, false, true, false})), - Map.of("id", new long[]{10, 11, 12, 13}, - "val", new NullableData(new long[]{1, 2, 3, 4}, new boolean[]{true, true, true, true}))); + Map.of(ColumnName.of("id"), new long[]{0, 1, 2, 3}, + ColumnName.of("val"), new NullableData(new long[]{10, 0, 30, 0}, new boolean[]{true, false, true, false})), + Map.of(ColumnName.of("id"), new long[]{10, 11, 12, 13}, + ColumnName.of("val"), new NullableData(new long[]{1, 2, 3, 4}, new boolean[]{true, true, true, true}))); try (Connection conn = connect(f)) { // When the first chunk is selected (id < 10) — folded from stats, no scan @@ -223,8 +223,8 @@ void unsignedKeyColumnAbandonsToScan() throws Exception { false); Path f = tmp.resolve("u64.vortex"); writeChunks(f, schema, - Map.of("id", new long[]{0, 1, 2, 3}, "val", new long[]{0, 1, 2, 3}), - Map.of("id", new long[]{10, 11, 12, 13}, "val", new long[]{10, 11, 12, 13})); + Map.of(ColumnName.of("id"), new long[]{0, 1, 2, 3}, ColumnName.of("val"), new long[]{0, 1, 2, 3}), + Map.of(ColumnName.of("id"), new long[]{10, 11, 12, 13}, ColumnName.of("val"), new long[]{10, 11, 12, 13})); try (Connection conn = connect(f)) { // When id < 10 over the unsigned key — a scan is present (no stats fold) @@ -307,10 +307,10 @@ void isNotNullBoundaryChunkFoldsViaDecode() throws Exception { false); Path f = tmp.resolve("isnotnull-boundary.vortex"); writeChunks(f, schema, - Map.of("id", new long[]{0, 1, 2, 3}, - "val", new NullableData(new long[]{5, 0, 7, 0}, new boolean[]{true, false, true, false})), - Map.of("id", new long[]{10, 11, 12, 13}, - "val", new NullableData(new long[]{10, 20, 30, 40}, new boolean[]{true, true, true, true}))); + Map.of(ColumnName.of("id"), new long[]{0, 1, 2, 3}, + ColumnName.of("val"), new NullableData(new long[]{5, 0, 7, 0}, new boolean[]{true, false, true, false})), + Map.of(ColumnName.of("id"), new long[]{10, 11, 12, 13}, + ColumnName.of("val"), new NullableData(new long[]{10, 20, 30, 40}, new boolean[]{true, true, true, true}))); try (Connection conn = connect(f)) { // When EXPLAIN runs, no scan is present — the boundary chunk was decoded and folded @@ -419,15 +419,15 @@ private static Path nullPartitionedFile(String name) throws Exception { false); Path f = tmp.resolve(name); writeChunks(f, schema, - Map.of("id", new long[]{0, 1, 2, 3}, - "val", new NullableData(new long[]{0, 0, 0, 0}, new boolean[]{false, false, false, false})), - Map.of("id", new long[]{10, 11, 12, 13}, - "val", new NullableData(new long[]{10, 20, 30, 40}, new boolean[]{true, true, true, true}))); + Map.of(ColumnName.of("id"), new long[]{0, 1, 2, 3}, + ColumnName.of("val"), new NullableData(new long[]{0, 0, 0, 0}, new boolean[]{false, false, false, false})), + Map.of(ColumnName.of("id"), new long[]{10, 11, 12, 13}, + ColumnName.of("val"), new NullableData(new long[]{10, 20, 30, 40}, new boolean[]{true, true, true, true}))); return f; } - private static void writeChunks(Path file, DType.Struct schema, Map chunk0, - Map chunk1) throws Exception { + private static void writeChunks(Path file, DType.Struct schema, Map chunk0, + Map chunk1) throws Exception { // chunkSize large so each writeChunk is exactly one chunk (one zone). WriteOptions opts = new WriteOptions(1024, true, 0.90, 0, false, false); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); diff --git a/calcite/src/test/java/io/github/dfa1/vortex/calcite/FilterPushDownTest.java b/calcite/src/test/java/io/github/dfa1/vortex/calcite/FilterPushDownTest.java index 02c6f808..e59a6a3f 100644 --- a/calcite/src/test/java/io/github/dfa1/vortex/calcite/FilterPushDownTest.java +++ b/calcite/src/test/java/io/github/dfa1/vortex/calcite/FilterPushDownTest.java @@ -1,5 +1,6 @@ package io.github.dfa1.vortex.calcite; +import io.github.dfa1.vortex.core.model.ColumnName; import io.github.dfa1.vortex.core.model.DType; import io.github.dfa1.vortex.writer.VortexWriter; import io.github.dfa1.vortex.writer.WriteOptions; @@ -47,17 +48,17 @@ static void write() throws Exception { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var w = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { w.writeChunk(Map.of( - "i64", new long[]{1000L, 2000L, 3000L}, - "i32", new int[]{100, 200, 300}, - "f64", new double[]{1.0, 2.0, 3.0}, - "s", new String[]{"a", "b", "c"}, - "b", new boolean[]{true, false, true})); + ColumnName.of("i64"), new long[]{1000L, 2000L, 3000L}, + ColumnName.of("i32"), new int[]{100, 200, 300}, + ColumnName.of("f64"), new double[]{1.0, 2.0, 3.0}, + ColumnName.of("s"), new String[]{"a", "b", "c"}, + ColumnName.of("b"), new boolean[]{true, false, true})); w.writeChunk(Map.of( - "i64", new long[]{4000L, 5000L, 6000L}, - "i32", new int[]{400, 500, 600}, - "f64", new double[]{4.0, 5.0, 6.0}, - "s", new String[]{"d", "e", "f"}, - "b", new boolean[]{false, true, false})); + ColumnName.of("i64"), new long[]{4000L, 5000L, 6000L}, + ColumnName.of("i32"), new int[]{400, 500, 600}, + ColumnName.of("f64"), new double[]{4.0, 5.0, 6.0}, + ColumnName.of("s"), new String[]{"d", "e", "f"}, + ColumnName.of("b"), new boolean[]{false, true, false})); } } diff --git a/calcite/src/test/java/io/github/dfa1/vortex/calcite/OhlcGenerator.java b/calcite/src/test/java/io/github/dfa1/vortex/calcite/OhlcGenerator.java index 0aa0284b..531c0c4c 100644 --- a/calcite/src/test/java/io/github/dfa1/vortex/calcite/OhlcGenerator.java +++ b/calcite/src/test/java/io/github/dfa1/vortex/calcite/OhlcGenerator.java @@ -1,5 +1,6 @@ package io.github.dfa1.vortex.calcite; +import io.github.dfa1.vortex.core.model.ColumnName; import io.github.dfa1.vortex.core.testing.OhlcData; import io.github.dfa1.vortex.writer.VortexWriter; import io.github.dfa1.vortex.writer.WriteOptions; @@ -23,14 +24,14 @@ static void write(Path file, int totalRows, int chunkSize) throws IOException { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var writer = VortexWriter.create(ch, OhlcData.SCHEMA, opts)) { for (OhlcData.Batch batch : OhlcData.generate(totalRows, chunkSize)) { - Map columns = new LinkedHashMap<>(); - columns.put("date", batch.date()); - columns.put("symbol", batch.symbol()); - columns.put("open", batch.open()); - columns.put("high", batch.high()); - columns.put("low", batch.low()); - columns.put("close", batch.close()); - columns.put("volume", batch.volume()); + Map columns = new LinkedHashMap<>(); + columns.put(ColumnName.of("date"), batch.date()); + columns.put(ColumnName.of("symbol"), batch.symbol()); + columns.put(ColumnName.of("open"), batch.open()); + columns.put(ColumnName.of("high"), batch.high()); + columns.put(ColumnName.of("low"), batch.low()); + columns.put(ColumnName.of("close"), batch.close()); + columns.put(ColumnName.of("volume"), batch.volume()); writer.writeChunk(columns); } } diff --git a/calcite/src/test/java/io/github/dfa1/vortex/calcite/VortexAdapterCoverageTest.java b/calcite/src/test/java/io/github/dfa1/vortex/calcite/VortexAdapterCoverageTest.java index 29caba89..50087ed8 100644 --- a/calcite/src/test/java/io/github/dfa1/vortex/calcite/VortexAdapterCoverageTest.java +++ b/calcite/src/test/java/io/github/dfa1/vortex/calcite/VortexAdapterCoverageTest.java @@ -1,5 +1,7 @@ package io.github.dfa1.vortex.calcite; +import io.github.dfa1.vortex.core.model.ColumnName; + import io.github.dfa1.vortex.core.model.DType; import io.github.dfa1.vortex.reader.ReadRegistry; import io.github.dfa1.vortex.reader.VortexReader; @@ -56,18 +58,18 @@ static void write() throws Exception { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var w = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { w.writeChunk(Map.ofEntries( - Map.entry("i8", new byte[]{1, 2, 3}), - Map.entry("i16", new short[]{10, 20, 30}), - Map.entry("i32", new int[]{100, 200, 300}), - Map.entry("i64", new long[]{1000L, 2000L, 3000L}), - Map.entry("u8", new byte[]{4, 5, 6}), - Map.entry("u16", new short[]{40, 50, 60}), - Map.entry("u32", new int[]{400, 500, 600}), - Map.entry("u64", new long[]{4000L, 5000L, 6000L}), - Map.entry("f32", new float[]{1.5f, 2.5f, 3.5f}), - Map.entry("f64", new double[]{1.25, 2.25, 3.25}), - Map.entry("s", new String[]{"a", "b", "c"}), - Map.entry("b", new boolean[]{true, false, true}))); + Map.entry(ColumnName.of("i8"), new byte[]{1, 2, 3}), + Map.entry(ColumnName.of("i16"), new short[]{10, 20, 30}), + Map.entry(ColumnName.of("i32"), new int[]{100, 200, 300}), + Map.entry(ColumnName.of("i64"), new long[]{1000L, 2000L, 3000L}), + Map.entry(ColumnName.of("u8"), new byte[]{4, 5, 6}), + Map.entry(ColumnName.of("u16"), new short[]{40, 50, 60}), + Map.entry(ColumnName.of("u32"), new int[]{400, 500, 600}), + Map.entry(ColumnName.of("u64"), new long[]{4000L, 5000L, 6000L}), + Map.entry(ColumnName.of("f32"), new float[]{1.5f, 2.5f, 3.5f}), + Map.entry(ColumnName.of("f64"), new double[]{1.25, 2.25, 3.25}), + Map.entry(ColumnName.of("s"), new String[]{"a", "b", "c"}), + Map.entry(ColumnName.of("b"), new boolean[]{true, false, true}))); } } @@ -278,18 +280,18 @@ void noZoneMap_sumFallsBackToFullScan(@TempDir Path noStats) throws Exception { try (var ch = FileChannel.open(bare, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var w = VortexWriter.create(ch, SCHEMA, noZoneMaps)) { w.writeChunk(Map.ofEntries( - Map.entry("i8", new byte[]{1, 2, 3}), - Map.entry("i16", new short[]{10, 20, 30}), - Map.entry("i32", new int[]{100, 200, 300}), - Map.entry("i64", new long[]{1000L, 2000L, 3000L}), - Map.entry("u8", new byte[]{4, 5, 6}), - Map.entry("u16", new short[]{40, 50, 60}), - Map.entry("u32", new int[]{400, 500, 600}), - Map.entry("u64", new long[]{4000L, 5000L, 6000L}), - Map.entry("f32", new float[]{1.5f, 2.5f, 3.5f}), - Map.entry("f64", new double[]{1.25, 2.25, 3.25}), - Map.entry("s", new String[]{"a", "b", "c"}), - Map.entry("b", new boolean[]{true, false, true}))); + Map.entry(ColumnName.of("i8"), new byte[]{1, 2, 3}), + Map.entry(ColumnName.of("i16"), new short[]{10, 20, 30}), + Map.entry(ColumnName.of("i32"), new int[]{100, 200, 300}), + Map.entry(ColumnName.of("i64"), new long[]{1000L, 2000L, 3000L}), + Map.entry(ColumnName.of("u8"), new byte[]{4, 5, 6}), + Map.entry(ColumnName.of("u16"), new short[]{40, 50, 60}), + Map.entry(ColumnName.of("u32"), new int[]{400, 500, 600}), + Map.entry(ColumnName.of("u64"), new long[]{4000L, 5000L, 6000L}), + Map.entry(ColumnName.of("f32"), new float[]{1.5f, 2.5f, 3.5f}), + Map.entry(ColumnName.of("f64"), new double[]{1.25, 2.25, 3.25}), + Map.entry(ColumnName.of("s"), new String[]{"a", "b", "c"}), + Map.entry(ColumnName.of("b"), new boolean[]{true, false, true}))); } // When diff --git a/cli/src/test/java/io/github/dfa1/vortex/cli/CliTestSupport.java b/cli/src/test/java/io/github/dfa1/vortex/cli/CliTestSupport.java index 2080d4f7..584f835a 100644 --- a/cli/src/test/java/io/github/dfa1/vortex/cli/CliTestSupport.java +++ b/cli/src/test/java/io/github/dfa1/vortex/cli/CliTestSupport.java @@ -31,7 +31,7 @@ static Path writeSmallVortex(Path dir, String name) throws IOException { false); try (FileChannel ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); VortexWriter writer = VortexWriter.create(ch, schema, WriteOptions.defaults())) { - writer.writeChunk(Map.of("id", new long[]{1L, 2L, 3L})); + writer.writeChunk(Map.of(ColumnName.of("id"), new long[]{1L, 2L, 3L})); } return file; } @@ -52,10 +52,10 @@ static Path writeTypedVortex(Path dir, String name) throws IOException { try (FileChannel ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); VortexWriter writer = VortexWriter.create(ch, schema, WriteOptions.defaults())) { writer.writeChunk(Map.of( - "id", new long[]{1L, 2L, 3L}, - "qty", new int[]{10, 20, 30}, - "price", new double[]{100.0, 200.0, 300.0}, - "name", new String[]{"alice", "bob", "carol"})); + ColumnName.of("id"), new long[]{1L, 2L, 3L}, + ColumnName.of("qty"), new int[]{10, 20, 30}, + ColumnName.of("price"), new double[]{100.0, 200.0, 300.0}, + ColumnName.of("name"), new String[]{"alice", "bob", "carol"})); } return file; } diff --git a/cli/src/test/java/io/github/dfa1/vortex/cli/tui/TuiTestSupport.java b/cli/src/test/java/io/github/dfa1/vortex/cli/tui/TuiTestSupport.java index e03b3e48..e391038d 100644 --- a/cli/src/test/java/io/github/dfa1/vortex/cli/tui/TuiTestSupport.java +++ b/cli/src/test/java/io/github/dfa1/vortex/cli/tui/TuiTestSupport.java @@ -45,7 +45,7 @@ static Path writeGridVortex(Path dir, String name, int rows) throws IOException } try (FileChannel ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); VortexWriter writer = VortexWriter.create(ch, schema, WriteOptions.defaults())) { - writer.writeChunk(Map.of("a", a, "b", b, "c", c)); + writer.writeChunk(Map.of(ColumnName.of("a"), a, ColumnName.of("b"), b, ColumnName.of("c"), c)); } return file; } @@ -66,15 +66,15 @@ static Path writeMultiTypeVortex(Path dir, String name) throws IOException { try (FileChannel ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); VortexWriter writer = VortexWriter.create(ch, schema, WriteOptions.defaults())) { writer.writeChunk(Map.of( - "i", new long[]{0, 1, 2}, - "d", new double[]{0.5, 1.5, 2.5}, - "flag", new boolean[]{true, false, true}, - "name", new String[]{"a", "b", "c"})); + ColumnName.of("i"), new long[]{0, 1, 2}, + ColumnName.of("d"), new double[]{0.5, 1.5, 2.5}, + ColumnName.of("flag"), new boolean[]{true, false, true}, + ColumnName.of("name"), new String[]{"a", "b", "c"})); writer.writeChunk(Map.of( - "i", new long[]{3, 4}, - "d", new double[]{3.5, 4.5}, - "flag", new boolean[]{false, true}, - "name", new String[]{"d", "e"})); + ColumnName.of("i"), new long[]{3, 4}, + ColumnName.of("d"), new double[]{3.5, 4.5}, + ColumnName.of("flag"), new boolean[]{false, true}, + ColumnName.of("name"), new String[]{"d", "e"})); } return file; } @@ -101,7 +101,7 @@ static Path writeRichVortex(Path dir, String name, int rows) throws IOException } try (FileChannel ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); VortexWriter writer = VortexWriter.create(ch, schema, WriteOptions.defaults())) { - writer.writeChunk(Map.of("label", label, "n", n)); + writer.writeChunk(Map.of(ColumnName.of("label"), label, ColumnName.of("n"), n)); } return file; } diff --git a/csv/src/main/java/io/github/dfa1/vortex/csv/CsvImporter.java b/csv/src/main/java/io/github/dfa1/vortex/csv/CsvImporter.java index 812df4c1..1bc7cea1 100644 --- a/csv/src/main/java/io/github/dfa1/vortex/csv/CsvImporter.java +++ b/csv/src/main/java/io/github/dfa1/vortex/csv/CsvImporter.java @@ -209,11 +209,11 @@ private static DType resolveType(boolean canBeLong, boolean canBeDouble, boolean return DType.UTF8; } - static Map buildChunk(DType.Struct schema, List rows) { + static Map buildChunk(DType.Struct schema, List rows) { int n = rows.size(); - Map chunk = new LinkedHashMap<>(); + Map chunk = new LinkedHashMap<>(); for (int c = 0; c < schema.fieldNames().size(); c++) { - chunk.put(schema.fieldNames().get(c).value(), buildColumn(schema.fieldTypes().get(c), rows, c, n)); + chunk.put(schema.fieldNames().get(c), buildColumn(schema.fieldTypes().get(c), rows, c, n)); } return chunk; } diff --git a/csv/src/test/java/io/github/dfa1/vortex/csv/CsvExporterTest.java b/csv/src/test/java/io/github/dfa1/vortex/csv/CsvExporterTest.java index 0a302359..16923d0b 100644 --- a/csv/src/test/java/io/github/dfa1/vortex/csv/CsvExporterTest.java +++ b/csv/src/test/java/io/github/dfa1/vortex/csv/CsvExporterTest.java @@ -29,7 +29,7 @@ void exportsToCsvFile(@TempDir Path tmp) throws Exception { false); try (FileChannel ch = FileChannel.open(vortex, StandardOpenOption.CREATE, StandardOpenOption.WRITE); VortexWriter writer = VortexWriter.create(ch, schema, WriteOptions.defaults())) { - writer.writeChunk(Map.of("id", new long[]{1L, 2L}, "name", new String[]{"Alice", "Bob"})); + writer.writeChunk(Map.of(ColumnName.of("id"), new long[]{1L, 2L}, ColumnName.of("name"), new String[]{"Alice", "Bob"})); } Path csv = tmp.resolve("out.csv"); @@ -54,7 +54,7 @@ void exportsToWriter(@TempDir Path tmp) throws Exception { false); try (FileChannel ch = FileChannel.open(vortex, StandardOpenOption.CREATE, StandardOpenOption.WRITE); VortexWriter writer = VortexWriter.create(ch, schema, WriteOptions.defaults())) { - writer.writeChunk(Map.of("x", new double[]{1.5, 2.7})); + writer.writeChunk(Map.of(ColumnName.of("x"), new double[]{1.5, 2.7})); } StringWriter out = new StringWriter(); @@ -79,7 +79,7 @@ void suppressesHeaderWhenConfigured(@TempDir Path tmp) throws Exception { false); try (FileChannel ch = FileChannel.open(vortex, StandardOpenOption.CREATE, StandardOpenOption.WRITE); VortexWriter writer = VortexWriter.create(ch, schema, WriteOptions.defaults())) { - writer.writeChunk(Map.of("id", new long[]{7L})); + writer.writeChunk(Map.of(ColumnName.of("id"), new long[]{7L})); } Path csv = tmp.resolve("out.csv"); diff --git a/integration/src/test/java/io/github/dfa1/vortex/integration/ConstantEncodingSelectionIntegrationTest.java b/integration/src/test/java/io/github/dfa1/vortex/integration/ConstantEncodingSelectionIntegrationTest.java index 3fc2bdf1..92d13939 100644 --- a/integration/src/test/java/io/github/dfa1/vortex/integration/ConstantEncodingSelectionIntegrationTest.java +++ b/integration/src/test/java/io/github/dfa1/vortex/integration/ConstantEncodingSelectionIntegrationTest.java @@ -36,7 +36,7 @@ void cascading_allZeroColumn_usesConstantEncoding(@TempDir Path tmp) throws IOEx long[] zeros = new long[10_000]; try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.cascading(3))) { - sut.writeChunk(Map.of("v", zeros)); + sut.writeChunk(Map.of(ColumnName.of("v"), zeros)); } // When diff --git a/integration/src/test/java/io/github/dfa1/vortex/integration/FileSizeComparisonIntegrationTest.java b/integration/src/test/java/io/github/dfa1/vortex/integration/FileSizeComparisonIntegrationTest.java index 23518da2..264825b3 100644 --- a/integration/src/test/java/io/github/dfa1/vortex/integration/FileSizeComparisonIntegrationTest.java +++ b/integration/src/test/java/io/github/dfa1/vortex/integration/FileSizeComparisonIntegrationTest.java @@ -121,9 +121,9 @@ private static Path writeJava(Path dir, String filename, WriteOptions opts, VortexWriter writer = VortexWriter.create(ch, JAVA_SCHEMA, opts)) { for (OhlcData.Batch b : batches) { writer.writeChunk(Map.of( - "symbol", b.symbol(), "date", b.date(), - "open", b.open(), "high", b.high(), - "low", b.low(), "close", b.close(), "volume", b.volume())); + ColumnName.of("symbol"), b.symbol(), ColumnName.of("date"), b.date(), + ColumnName.of("open"), b.open(), ColumnName.of("high"), b.high(), + ColumnName.of("low"), b.low(), ColumnName.of("close"), b.close(), ColumnName.of("volume"), b.volume())); } } return file; @@ -313,7 +313,7 @@ private static void comparePcoI64(Path dir, String name, long[] data, try (FileChannel ch = FileChannel.open(javaFile, StandardOpenOption.CREATE, StandardOpenOption.WRITE); VortexWriter writer = VortexWriter.create( ch, javaSchema, WriteOptions.defaults(), List.of(new PcoEncodingEncoder()))) { - writer.writeChunk(Map.of("v", data)); + writer.writeChunk(Map.of(ColumnName.of("v"), data)); } Path jniFile = dir.resolve("pco-jni-" + name + ".vtx"); @@ -368,7 +368,7 @@ void highCardinalityUtf8_javaVsJni(@TempDir Path tmp) throws IOException { try (FileChannel ch = FileChannel.open(javaFile, StandardOpenOption.CREATE, StandardOpenOption.WRITE); VortexWriter writer = VortexWriter.create( ch, javaSchema, WriteOptions.cascading(3).withGlobalDict(false))) { - writer.writeChunk(Map.of("s", data)); + writer.writeChunk(Map.of(ColumnName.of("s"), data)); } Path jniFile = tmp.resolve("hicard-jni.vtx"); diff --git a/integration/src/test/java/io/github/dfa1/vortex/integration/JavaRoundTripIntegrationTest.java b/integration/src/test/java/io/github/dfa1/vortex/integration/JavaRoundTripIntegrationTest.java index 0e75950b..7b8e8b91 100644 --- a/integration/src/test/java/io/github/dfa1/vortex/integration/JavaRoundTripIntegrationTest.java +++ b/integration/src/test/java/io/github/dfa1/vortex/integration/JavaRoundTripIntegrationTest.java @@ -53,7 +53,7 @@ void patched_i32_javaWriteJavaRead(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I32_SCHEMA, WriteOptions.defaults(), List.of(new PatchedEncodingEncoder()))) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then — the Java reader reconstructs base values + patched outliers exactly diff --git a/integration/src/test/java/io/github/dfa1/vortex/integration/JavaWritesRustReadsIntegrationTest.java b/integration/src/test/java/io/github/dfa1/vortex/integration/JavaWritesRustReadsIntegrationTest.java index a7eae05b..caac1873 100644 --- a/integration/src/test/java/io/github/dfa1/vortex/integration/JavaWritesRustReadsIntegrationTest.java +++ b/integration/src/test/java/io/github/dfa1/vortex/integration/JavaWritesRustReadsIntegrationTest.java @@ -436,13 +436,13 @@ void javaWriter_jniReader_cascading_ohlc(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, OHLC_SCHEMA, WriteOptions.cascading(3))) { for (OhlcData.Batch b : batches) { sut.writeChunk(Map.of( - "date", b.date(), - "symbol", b.symbol(), - "open", b.open(), - "high", b.high(), - "low", b.low(), - "close", b.close(), - "volume", b.volume())); + ColumnName.of("date"), b.date(), + ColumnName.of("symbol"), b.symbol(), + ColumnName.of("open"), b.open(), + ColumnName.of("high"), b.high(), + ColumnName.of("low"), b.low(), + ColumnName.of("close"), b.close(), + ColumnName.of("volume"), b.volume())); } } @@ -468,7 +468,7 @@ void javaWriter_jniReader_singleChunk(@TempDir Path tmp) throws IOException { double[] vals = {1.1, 2.2, 3.3}; try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("id", ids, "value", vals)); + sut.writeChunk(Map.of(ColumnName.of("id"), ids, ColumnName.of("value"), vals)); } // When @@ -486,8 +486,8 @@ void javaWriter_jniReader_multipleChunks(@TempDir Path tmp) throws IOException { Path file = tmp.resolve("java_multi.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("id", new long[]{1L, 2L}, "value", new double[]{1.1, 2.2})); - sut.writeChunk(Map.of("id", new long[]{3L, 4L, 5L}, "value", new double[]{3.3, 4.4, 5.5})); + sut.writeChunk(Map.of(ColumnName.of("id"), new long[]{1L, 2L}, ColumnName.of("value"), new double[]{1.1, 2.2})); + sut.writeChunk(Map.of(ColumnName.of("id"), new long[]{3L, 4L, 5L}, ColumnName.of("value"), new double[]{3.3, 4.4, 5.5})); } // When @@ -514,8 +514,8 @@ void javaWriter_jniReader_zoneMapped_multipleZones(@TempDir Path tmp) throws IOE var sut = VortexWriter.create(ch, SCHEMA, zoneMapped)) { for (int start = 0; start < 20; start += 4) { sut.writeChunk(Map.of( - "id", Arrays.copyOfRange(ids, start, start + 4), - "value", Arrays.copyOfRange(vals, start, start + 4))); + ColumnName.of("id"), Arrays.copyOfRange(ids, start, start + 4), + ColumnName.of("value"), Arrays.copyOfRange(vals, start, start + 4))); } } @@ -536,7 +536,7 @@ void javaWriter_jniReader_i32Column(@TempDir Path tmp) throws IOException { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, I32_SCHEMA, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then @@ -553,7 +553,7 @@ void javaWriter_jniReader_utf8Column(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, STRING_SCHEMA, WriteOptions.defaults(), List.of(new VarBinEncodingEncoder()))) { // When - sut.writeChunk(Map.of("s", data)); + sut.writeChunk(Map.of(ColumnName.of("s"), data)); } // Then @@ -570,7 +570,7 @@ void javaWriter_jniReader_fsstUtf8Column(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, STRING_SCHEMA, WriteOptions.defaults(), List.of(new FsstEncodingEncoder()))) { // When - sut.writeChunk(Map.of("s", data)); + sut.writeChunk(Map.of(ColumnName.of("s"), data)); } // Then @@ -587,7 +587,7 @@ void javaWriter_jniReader_varBinViewUtf8Column_inlined(@TempDir Path tmp) throws var sut = VortexWriter.create(ch, STRING_SCHEMA, WriteOptions.defaults(), List.of(new VarBinViewEncodingEncoder()))) { // When - sut.writeChunk(Map.of("s", data)); + sut.writeChunk(Map.of(ColumnName.of("s"), data)); } // Then @@ -604,7 +604,7 @@ void javaWriter_jniReader_varBinViewUtf8Column_referenced(@TempDir Path tmp) thr var sut = VortexWriter.create(ch, STRING_SCHEMA, WriteOptions.defaults(), List.of(new VarBinViewEncodingEncoder()))) { // When - sut.writeChunk(Map.of("s", data)); + sut.writeChunk(Map.of(ColumnName.of("s"), data)); } // Then @@ -621,7 +621,7 @@ void javaWriter_jniReader_varBinViewUtf8Column_mixed(@TempDir Path tmp) throws I var sut = VortexWriter.create(ch, STRING_SCHEMA, WriteOptions.defaults(), List.of(new VarBinViewEncodingEncoder()))) { // When - sut.writeChunk(Map.of("s", data)); + sut.writeChunk(Map.of(ColumnName.of("s"), data)); } // Then @@ -639,7 +639,7 @@ void prop_varBinView_utf8_roundTripsViaRust(String[] data) throws IOException { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, STRING_SCHEMA, WriteOptions.defaults(), List.of(new VarBinViewEncodingEncoder()))) { - sut.writeChunk(Map.of("s", data)); + sut.writeChunk(Map.of(ColumnName.of("s"), data)); } String[] decoded = readStringColumn(file, "s"); assertThat(decoded).containsExactly(data); @@ -656,7 +656,7 @@ void javaWriter_jniReader_dictEncodedUtf8Column(@TempDir Path tmp) throws IOExce try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, STRING_SCHEMA, WriteOptions.defaults())) { // When — default pipeline selects DictEncoding for Utf8 - sut.writeChunk(Map.of("s", data)); + sut.writeChunk(Map.of(ColumnName.of("s"), data)); } // Then @@ -678,7 +678,7 @@ void javaWriter_jniReader_largeChunk_twoFastLanesBlocks(@TempDir Path tmp) throw try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("id", ids, "value", vals)); + sut.writeChunk(Map.of(ColumnName.of("id"), ids, ColumnName.of("value"), vals)); } // Then @@ -698,7 +698,7 @@ void javaWriter_jniReader_monotonic_i64_cascading(@TempDir Path tmp) throws IOEx try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, TS_SCHEMA, WriteOptions.cascading(3))) { // When - sut.writeChunk(Map.of("ts", ts)); + sut.writeChunk(Map.of(ColumnName.of("ts"), ts)); } // Then @@ -715,9 +715,9 @@ void javaWriter_jniReader_cascading_ohlc_columnProjection(@TempDir Path tmp) thr var sut = VortexWriter.create(ch, OHLC_SCHEMA, WriteOptions.cascading(3))) { for (OhlcData.Batch b : batches) { sut.writeChunk(Map.of( - "date", b.date(), "symbol", b.symbol(), - "open", b.open(), "high", b.high(), - "low", b.low(), "close", b.close(), "volume", b.volume())); + ColumnName.of("date"), b.date(), ColumnName.of("symbol"), b.symbol(), + ColumnName.of("open"), b.open(), ColumnName.of("high"), b.high(), + ColumnName.of("low"), b.low(), ColumnName.of("close"), b.close(), ColumnName.of("volume"), b.volume())); } } @@ -739,7 +739,7 @@ void prop_dictUtf8_ascii_roundTripsViaRust(String[] data) throws IOException { Path file = tmp.resolve("pbt_dict_utf8_ascii.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, STRING_SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("s", data)); + sut.writeChunk(Map.of(ColumnName.of("s"), data)); } String[] decoded = readStringColumn(file, "s"); assertThat(decoded).containsExactly(data); @@ -757,7 +757,7 @@ void prop_dictUtf8_u16Codes_roundTripsViaRust(String[] data) throws IOException Path file = tmp.resolve("pbt_dict_utf8_u16.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, STRING_SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("s", data)); + sut.writeChunk(Map.of(ColumnName.of("s"), data)); } String[] decoded = readStringColumn(file, "s"); assertThat(decoded).containsExactly(data); @@ -775,7 +775,7 @@ void prop_dictUtf8_unicode_roundTripsViaRust(String[] data) throws IOException { Path file = tmp.resolve("pbt_dict_utf8_unicode.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, STRING_SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("s", data)); + sut.writeChunk(Map.of(ColumnName.of("s"), data)); } String[] decoded = readStringColumn(file, "s"); assertThat(decoded).containsExactly(data); @@ -793,7 +793,7 @@ void prop_i64_roundTripsViaRust(long[] data) throws IOException { Path file = tmp.resolve("pbt_i64.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, TS_SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } long[] decoded = readLongColumn(file, "ts"); assertThat(decoded).containsExactly(data); @@ -811,7 +811,7 @@ void prop_f64_roundTripsViaRust(double[] data) throws IOException { Path file = tmp.resolve("pbt_f64.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, F64_SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } double[] decoded = readDoubleColumn(file, "v"); assertThat(decoded).containsExactly(data); @@ -829,7 +829,7 @@ void prop_f32_roundTripsViaRust(float[] data) throws IOException { Path file = tmp.resolve("pbt_f32.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, F32_SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } float[] decoded = readFloatColumn(file, "v"); assertThat(decoded).containsExactly(data); @@ -847,7 +847,7 @@ void javaWriter_jniReader_f64_nanAndInf(@TempDir Path tmp) throws IOException { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, F64_SCHEMA, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then @@ -864,7 +864,7 @@ void javaWriter_jniReader_f32_nanAndInf(@TempDir Path tmp) throws IOException { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, F32_SCHEMA, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then @@ -884,7 +884,7 @@ void javaWriter_jniReader_f16_nanAndInf(@TempDir Path tmp) throws IOException { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, F16_SCHEMA, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then @@ -901,7 +901,7 @@ void javaWriter_rustReader_zigzag_i32(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I32_SCHEMA, WriteOptions.defaults(), List.of(new ZigZagEncodingEncoder()))) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then @@ -918,7 +918,7 @@ void javaWriter_rustReader_zigzag_i64(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, TS_SCHEMA, WriteOptions.defaults(), List.of(new ZigZagEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -935,7 +935,7 @@ void javaWriter_rustReader_runEnd_i32(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I32_SCHEMA, WriteOptions.defaults(), List.of(new RunEndEncodingEncoder()))) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then @@ -952,7 +952,7 @@ void javaWriter_rustReader_runEnd_i64(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, TS_SCHEMA, WriteOptions.defaults(), List.of(new RunEndEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -969,7 +969,7 @@ void javaWriter_rustReader_rle_i32(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I32_SCHEMA, WriteOptions.defaults(), List.of(new RleEncodingEncoder()))) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then @@ -986,7 +986,7 @@ void javaWriter_rustReader_rle_i64(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, TS_SCHEMA, WriteOptions.defaults(), List.of(new RleEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -1003,7 +1003,7 @@ void javaWriter_rustReader_constant_i32(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I32_SCHEMA, WriteOptions.defaults(), List.of(new ConstantEncodingEncoder()))) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then @@ -1020,7 +1020,7 @@ void javaWriter_rustReader_sparse_i32(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I32_SCHEMA, WriteOptions.defaults(), List.of(new SparseEncodingEncoder()))) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then @@ -1043,7 +1043,7 @@ void javaWriter_rustReader_delta_i64(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, TS_SCHEMA, WriteOptions.defaults(), List.of(new DeltaEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -1065,7 +1065,7 @@ void javaWriter_rustReader_masked_nullableI64(@TempDir Path tmp) throws IOExcept try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.defaults())) { // When — boxed Long[] via the map entry point routes through the nullable → masked path - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then — Rust reads a nullable BigInt vector; null positions survive, values round-trip @@ -1100,7 +1100,7 @@ void javaWriter_rustReader_masked_nullableUtf8(@TempDir Path tmp) throws IOExcep try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("s", data)); + sut.writeChunk(Map.of(ColumnName.of("s"), data)); } // Then — Rust reads the nullable Utf8 vector; null positions survive, values round-trip @@ -1132,7 +1132,7 @@ void javaWriter_rustReader_bool_boolEncoding(@TempDir Path tmp) throws IOExcepti var sut = VortexWriter.create(ch, BOOL_SCHEMA, WriteOptions.defaults(), List.of(new BoolEncodingEncoder()))) { // When - sut.writeChunk(Map.of("b", data)); + sut.writeChunk(Map.of(ColumnName.of("b"), data)); } // Then @@ -1151,7 +1151,7 @@ void javaWriter_rustReader_bool_byteBoolEncoding(@TempDir Path tmp) throws IOExc var sut = VortexWriter.create(ch, BOOL_SCHEMA, WriteOptions.defaults(), List.of(new ByteBoolEncodingEncoder()))) { // When - sut.writeChunk(Map.of("b", data)); + sut.writeChunk(Map.of(ColumnName.of("b"), data)); } // Then @@ -1168,7 +1168,7 @@ void javaWriter_rustReader_nullColumn(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, NULL_SCHEMA, WriteOptions.defaults(), List.of(new NullEncodingEncoder()))) { // When — data is ignored by NullEncoding; pass long[] to satisfy arrayLength - sut.writeChunk(Map.of("n", new long[(int) rowCount])); + sut.writeChunk(Map.of(ColumnName.of("n"), new long[(int) rowCount])); } // Then @@ -1185,7 +1185,7 @@ void javaWriter_rustReader_zstd_i64(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, TS_SCHEMA, WriteOptions.defaults(), List.of(new ZstdEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -1202,7 +1202,7 @@ void javaWriter_rustReader_zstd_utf8(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, STRING_SCHEMA, WriteOptions.defaults(), List.of(new ZstdEncodingEncoder()))) { // When - sut.writeChunk(Map.of("s", data)); + sut.writeChunk(Map.of(ColumnName.of("s"), data)); } // Then @@ -1221,7 +1221,7 @@ void javaWriter_rustReader_zstd_multiFrameI64(@TempDir Path tmp) throws IOExcept var sut = VortexWriter.create(ch, TS_SCHEMA, WriteOptions.defaults(), List.of(new ZstdEncodingEncoder(3)))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -1242,7 +1242,7 @@ void javaWriter_rustReader_zstd_nullableI64(@TempDir Path tmp) throws IOExceptio var sut = VortexWriter.create(ch, schema, WriteOptions.defaults(), List.of(new ZstdEncodingEncoder()))) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then — Rust reads a nullable BigInt vector; null positions survive, values round-trip @@ -1278,7 +1278,7 @@ void javaWriter_rustReader_zstd_nullableUtf8(@TempDir Path tmp) throws IOExcepti var sut = VortexWriter.create(ch, schema, WriteOptions.defaults(), List.of(new ZstdEncodingEncoder()))) { // When - sut.writeChunk(Map.of("s", data)); + sut.writeChunk(Map.of(ColumnName.of("s"), data)); } // Then — Rust reads the nullable Utf8 vector; null positions survive, values round-trip @@ -1312,7 +1312,7 @@ void javaWriter_rustReader_list_i64(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, LIST_I64_SCHEMA, WriteOptions.defaults(), List.of(new ListEncodingEncoder()))) { // When - sut.writeChunk(Map.of("items", data)); + sut.writeChunk(Map.of(ColumnName.of("items"), data)); } // Then @@ -1332,7 +1332,7 @@ void javaWriter_rustReader_listView_i64(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, LIST_I64_SCHEMA, WriteOptions.defaults(), List.of(new ListViewEncodingEncoder()))) { // When - sut.writeChunk(Map.of("items", data)); + sut.writeChunk(Map.of(ColumnName.of("items"), data)); } // Then — Rust normalizes ListView to List on read; verify flattened elements @@ -1352,7 +1352,7 @@ void javaWriter_rustReader_cascading_withZstd_f64(@TempDir Path tmp) throws IOEx try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, F64_SCHEMA, WriteOptions.cascading(3).withZstd(true))) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then — Rust reader must decode the file (whether via ALP or Zstd, value-equal) @@ -1373,8 +1373,8 @@ void javaWriter_rustReader_globalDict_i64(@TempDir Path tmp) throws IOException try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("v", chunk1)); - sut.writeChunk(Map.of("v", chunk2)); + sut.writeChunk(Map.of(ColumnName.of("v"), chunk1)); + sut.writeChunk(Map.of(ColumnName.of("v"), chunk2)); } // Then — Rust must decode the DictLayout and return original values @@ -1398,8 +1398,8 @@ void javaWriter_rustReader_globalDict_f64(@TempDir Path tmp) throws IOException try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("v", chunk1)); - sut.writeChunk(Map.of("v", chunk2)); + sut.writeChunk(Map.of(ColumnName.of("v"), chunk1)); + sut.writeChunk(Map.of(ColumnName.of("v"), chunk2)); } // Then @@ -1422,7 +1422,7 @@ void javaWriter_rustReader_nullable_date(@TempDir Path tmp) throws IOException { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("d", Arrays.asList(d0, null, d2))); + sut.writeChunk(Map.of(ColumnName.of("d"), Arrays.asList(d0, null, d2))); } // Then — Rust reads Date32 vector; row 1 null, rows 0/2 round-trip as epoch-day @@ -1457,7 +1457,7 @@ void javaWriter_rustReader_nullable_time(@TempDir Path tmp) throws IOException { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("t", Arrays.asList(t0, null, t2))); + sut.writeChunk(Map.of(ColumnName.of("t"), Arrays.asList(t0, null, t2))); } // Then — Rust reads Time32(ms) vector; row 1 null, rows 0/2 round-trip as millis-of-day @@ -1492,7 +1492,7 @@ void javaWriter_rustReader_nullable_timestamp(@TempDir Path tmp) throws IOExcept try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("ts", Arrays.asList(ts0, null, ts2))); + sut.writeChunk(Map.of(ColumnName.of("ts"), Arrays.asList(ts0, null, ts2))); } // Then — Rust reads Timestamp(ms) vector; row 1 null, rows 0/2 round-trip as epoch millis @@ -1530,7 +1530,7 @@ void javaWriter_rustReader_nullable_uuid(@TempDir Path tmp) throws IOException { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("u", Arrays.asList(u0, null, u2))); + sut.writeChunk(Map.of(ColumnName.of("u"), Arrays.asList(u0, null, u2))); } // Then — Rust reads FixedSizeBinary(16) vector; row 1 null, rows 0/2 round-trip as UUID @@ -1564,7 +1564,7 @@ void javaWriter_rustReader_pco_i64_noOp(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, TS_SCHEMA, WriteOptions.defaults(), List.of(new PcoEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -1581,7 +1581,7 @@ void javaWriter_rustReader_pco_i64_consecutive(@TempDir Path tmp) throws IOExcep var sut = VortexWriter.create(ch, TS_SCHEMA, WriteOptions.defaults(), List.of(new PcoEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -1598,7 +1598,7 @@ void javaWriter_rustReader_pco_i32(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I32_SCHEMA, WriteOptions.defaults(), List.of(new PcoEncodingEncoder()))) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then @@ -1615,7 +1615,7 @@ void javaWriter_rustReader_pco_f64(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, F64_SCHEMA, WriteOptions.defaults(), List.of(new PcoEncodingEncoder()))) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then @@ -1632,7 +1632,7 @@ void javaWriter_rustReader_pco_f32(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, F32_SCHEMA, WriteOptions.defaults(), List.of(new PcoEncodingEncoder()))) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then @@ -1649,7 +1649,7 @@ void javaWriter_rustReader_pco_i64_twoChunks(@TempDir Path tmp) throws IOExcepti var sut = VortexWriter.create(ch, TS_SCHEMA, WriteOptions.defaults(), List.of(new PcoEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -1666,7 +1666,7 @@ void javaWriter_rustReader_pco_i64_multiChunk(@TempDir Path tmp) throws IOExcept var sut = VortexWriter.create(ch, TS_SCHEMA, WriteOptions.defaults(), List.of(new PcoEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -1683,7 +1683,7 @@ void javaWriter_rustReader_pco_i64_intMult(@TempDir Path tmp) throws IOException var sut = VortexWriter.create(ch, TS_SCHEMA, WriteOptions.defaults(), List.of(new PcoEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -1711,7 +1711,7 @@ void prop_pco_i64_consecutive_roundTripsViaRust(long[] data) throws IOException try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, TS_SCHEMA, WriteOptions.defaults(), List.of(new PcoEncodingEncoder()))) { - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } long[] decoded = readLongColumn(file, "ts"); assertThat(decoded).containsExactly(data); diff --git a/integration/src/test/java/io/github/dfa1/vortex/integration/VariantJavaWritesRustReadsIntegrationTest.java b/integration/src/test/java/io/github/dfa1/vortex/integration/VariantJavaWritesRustReadsIntegrationTest.java index 580506bd..8fa1c0ae 100644 --- a/integration/src/test/java/io/github/dfa1/vortex/integration/VariantJavaWritesRustReadsIntegrationTest.java +++ b/integration/src/test/java/io/github/dfa1/vortex/integration/VariantJavaWritesRustReadsIntegrationTest.java @@ -58,7 +58,7 @@ void javaWriter_jniReader_constantVariantColumn(@TempDir Path tmp) throws IOExce try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, VARIANT_SCHEMA, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then — the Rust reader parses the variant layout and agrees on row count + schema. @@ -82,7 +82,7 @@ void javaWriter_jniReader_varyingVariantColumn(@TempDir Path tmp) throws IOExcep try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, VARIANT_SCHEMA, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then — the Rust reader parses the chunked variant layout and agrees on row count + schema. @@ -103,7 +103,7 @@ void javaWriter_jniReader_shreddedVariantColumn(@TempDir Path tmp) throws IOExce try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, VARIANT_SCHEMA, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then — the Rust reader parses the shredded variant layout and agrees on row count + schema. diff --git a/jdbc/src/main/java/io/github/dfa1/vortex/jdbc/JdbcImporter.java b/jdbc/src/main/java/io/github/dfa1/vortex/jdbc/JdbcImporter.java index d92e9511..f1eb5d8b 100644 --- a/jdbc/src/main/java/io/github/dfa1/vortex/jdbc/JdbcImporter.java +++ b/jdbc/src/main/java/io/github/dfa1/vortex/jdbc/JdbcImporter.java @@ -269,20 +269,20 @@ private static UUID toUuid(Object raw) { "unsupported JDBC UUID representation: " + (raw == null ? "null" : raw.getClass().getName())); } - private static Map toChunkMap(DType.Struct schema, Object[] buffers, + private static Map toChunkMap(DType.Struct schema, Object[] buffers, boolean[][] validity, boolean[] anyNull, int rows) { List names = schema.fieldNames().stream().map(ColumnName::value).toList(); - Map chunk = new LinkedHashMap<>(); + Map chunk = new LinkedHashMap<>(); for (int c = 0; c < names.size(); c++) { Object trimmed = trimBuffer(buffers[c], rows); if (validity[c] != null && anyNull[c]) { boolean[] trimmedValidity = rows == validity[c].length ? validity[c] : Arrays.copyOf(validity[c], rows); - chunk.put(names.get(c), + chunk.put(ColumnName.of(names.get(c)), new io.github.dfa1.vortex.writer.encode.NullableData(trimmed, trimmedValidity)); } else { - chunk.put(names.get(c), trimmed); + chunk.put(ColumnName.of(names.get(c)), trimmed); } } return chunk; diff --git a/parquet/src/main/java/io/github/dfa1/vortex/parquet/ParquetImporter.java b/parquet/src/main/java/io/github/dfa1/vortex/parquet/ParquetImporter.java index 89ca3f92..b0759112 100644 --- a/parquet/src/main/java/io/github/dfa1/vortex/parquet/ParquetImporter.java +++ b/parquet/src/main/java/io/github/dfa1/vortex/parquet/ParquetImporter.java @@ -221,16 +221,16 @@ private static void fillRow(RowReader reader, List columns, Object } } - private static Map buildChunk(List columns, List types, + private static Map buildChunk(List columns, List types, Object[] buffers, int size) { - Map chunk = new LinkedHashMap<>(); + Map chunk = new LinkedHashMap<>(); for (int c = 0; c < columns.size(); c++) { Object buf = trimBuffer(buffers[c], size); if (types.get(c) instanceof DType.Extension) { boolean nullable = types.get(c).nullable(); buf = new DateTimePartsData((long[]) buf, nullable); } - chunk.put(columns.get(c).name(), buf); + chunk.put(ColumnName.of(columns.get(c).name()), buf); } return chunk; } diff --git a/performance/src/main/java/io/github/dfa1/vortex/performance/CalciteBoundaryAggregateBenchmark.java b/performance/src/main/java/io/github/dfa1/vortex/performance/CalciteBoundaryAggregateBenchmark.java index 4c8f7ee5..7535d90f 100644 --- a/performance/src/main/java/io/github/dfa1/vortex/performance/CalciteBoundaryAggregateBenchmark.java +++ b/performance/src/main/java/io/github/dfa1/vortex/performance/CalciteBoundaryAggregateBenchmark.java @@ -1,5 +1,6 @@ package io.github.dfa1.vortex.performance; +import io.github.dfa1.vortex.core.model.ColumnName; import io.github.dfa1.vortex.calcite.VortexTable; import io.github.dfa1.vortex.core.model.DType; import io.github.dfa1.vortex.reader.Chunk; @@ -205,7 +206,7 @@ private static void writeFixture(Path file) throws IOException { id[i] = (long) c * CHUNK_SIZE + i; val[i] = rng.nextInt(1_000); } - writer.writeChunk(Map.of("id", id, "val", val)); + writer.writeChunk(Map.of(ColumnName.of("id"), id, ColumnName.of("val"), val)); } } } diff --git a/performance/src/main/java/io/github/dfa1/vortex/performance/ComputeKernelBenchmark.java b/performance/src/main/java/io/github/dfa1/vortex/performance/ComputeKernelBenchmark.java index 4d541a61..7534cbc0 100644 --- a/performance/src/main/java/io/github/dfa1/vortex/performance/ComputeKernelBenchmark.java +++ b/performance/src/main/java/io/github/dfa1/vortex/performance/ComputeKernelBenchmark.java @@ -579,10 +579,10 @@ private void write(Path path) throws IOException { plainData[i] = rng.nextLong(); } writer.writeChunk(Map.of( - "price", priceData, - "measure", measureData, - "category", categoryData, - "plain", plainData)); + ColumnName.of("price"), priceData, + ColumnName.of("measure"), measureData, + ColumnName.of("category"), categoryData, + ColumnName.of("plain"), plainData)); } } } diff --git a/performance/src/main/java/io/github/dfa1/vortex/performance/JavaVsJniReadBenchmark.java b/performance/src/main/java/io/github/dfa1/vortex/performance/JavaVsJniReadBenchmark.java index 065acf6e..77ac573a 100644 --- a/performance/src/main/java/io/github/dfa1/vortex/performance/JavaVsJniReadBenchmark.java +++ b/performance/src/main/java/io/github/dfa1/vortex/performance/JavaVsJniReadBenchmark.java @@ -464,13 +464,13 @@ private void writeJavaCascading(Path path) throws IOException { } day += n / NASDAQ_TICKERS.length; writer.writeChunk(Map.of( - "date", epochDays, - "symbol", symbols, - "open", open, - "high", high, - "low", low, - "close", close, - "volume", volume + ColumnName.of("date"), epochDays, + ColumnName.of("symbol"), symbols, + ColumnName.of("open"), open, + ColumnName.of("high"), high, + ColumnName.of("low"), low, + ColumnName.of("close"), close, + ColumnName.of("volume"), volume )); rowsLeft -= n; } diff --git a/performance/src/main/java/io/github/dfa1/vortex/performance/JavaVsJniWriteBenchmark.java b/performance/src/main/java/io/github/dfa1/vortex/performance/JavaVsJniWriteBenchmark.java index caf8e5c0..52cf9d91 100644 --- a/performance/src/main/java/io/github/dfa1/vortex/performance/JavaVsJniWriteBenchmark.java +++ b/performance/src/main/java/io/github/dfa1/vortex/performance/JavaVsJniWriteBenchmark.java @@ -214,14 +214,14 @@ public long javaWriteCascading() throws IOException { StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING); VortexWriter writer = VortexWriter.create(ch, JAVA_SCHEMA, WriteOptions.cascading(3))) { for (int b = 0; b < NUM_BATCHES; b++) { - Map chunk = Map.of( - "date", batchDates[b], - "symbol", batchSymbols[b], - "open", batchOpen[b], - "high", batchHigh[b], - "low", batchLow[b], - "close", batchClose[b], - "volume", batchVolume[b] + Map chunk = Map.of( + ColumnName.of("date"), batchDates[b], + ColumnName.of("symbol"), batchSymbols[b], + ColumnName.of("open"), batchOpen[b], + ColumnName.of("high"), batchHigh[b], + ColumnName.of("low"), batchLow[b], + ColumnName.of("close"), batchClose[b], + ColumnName.of("volume"), batchVolume[b] ); writer.writeChunk(chunk); } @@ -236,14 +236,14 @@ public long javaWrite() throws IOException { StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING); VortexWriter writer = VortexWriter.create(ch, JAVA_SCHEMA, WriteOptions.defaults())) { for (int b = 0; b < NUM_BATCHES; b++) { - Map chunk = Map.of( - "date", batchDates[b], - "symbol", batchSymbols[b], - "open", batchOpen[b], - "high", batchHigh[b], - "low", batchLow[b], - "close", batchClose[b], - "volume", batchVolume[b] + Map chunk = Map.of( + ColumnName.of("date"), batchDates[b], + ColumnName.of("symbol"), batchSymbols[b], + ColumnName.of("open"), batchOpen[b], + ColumnName.of("high"), batchHigh[b], + ColumnName.of("low"), batchLow[b], + ColumnName.of("close"), batchClose[b], + ColumnName.of("volume"), batchVolume[b] ); writer.writeChunk(chunk); } diff --git a/writer/src/main/java/io/github/dfa1/vortex/writer/ChunkImpl.java b/writer/src/main/java/io/github/dfa1/vortex/writer/ChunkImpl.java index f0738563..6d30bb52 100644 --- a/writer/src/main/java/io/github/dfa1/vortex/writer/ChunkImpl.java +++ b/writer/src/main/java/io/github/dfa1/vortex/writer/ChunkImpl.java @@ -34,17 +34,13 @@ public Chunk put(ColumnName column, Object value) { return this; } - Map finish() { + Map finish() { for (ColumnName name : schema.fieldNames()) { if (!data.containsKey(name)) { throw new IllegalStateException("missing column: " + name); } } - // The map entry point ([VortexWriter#writeChunk(Map)]) is keyed by raw name, so surface - // the validated keys as strings at this internal boundary. - Map result = new LinkedHashMap<>(data.size()); - data.forEach((name, value) -> result.put(name.value(), value)); - return result; + return data; } /// Validates a column's raw data against its schema dtype and adapts boxed nullable arrays diff --git a/writer/src/main/java/io/github/dfa1/vortex/writer/VortexWriter.java b/writer/src/main/java/io/github/dfa1/vortex/writer/VortexWriter.java index 33f7e794..a4d2ae8c 100644 --- a/writer/src/main/java/io/github/dfa1/vortex/writer/VortexWriter.java +++ b/writer/src/main/java/io/github/dfa1/vortex/writer/VortexWriter.java @@ -72,7 +72,7 @@ /// .build(); /// try (var channel = FileChannel.open(path, CREATE, WRITE); /// var writer = VortexWriter.create(channel, schema, WriteOptions.defaults())) { -/// writer.writeChunk(Map.of("id", idArray, "value", valueArray)); +/// writer.writeChunk(Map.of(ColumnName.of("id"), idArray, ColumnName.of("value"), valueArray)); /// } /// ``` public final class VortexWriter implements Closeable { @@ -407,19 +407,19 @@ public void writeChunk(java.util.function.Consumer builder) throws IOExce /// `Boolean[]`, …) with `null` marking absent rows; it routes through `MaskedEncoding` just like /// the builder form. Non-nullable columns take the raw primitive array (`long[]`, `int[]`, …). /// - /// @param columns map from column name to typed array data + /// @param columns map from [ColumnName] to typed array data /// @throws IOException if an I/O error occurs writing to the underlying channel /// @throws IllegalArgumentException if a schema column is missing from `columns`, /// or if column arrays disagree on row count - public void writeChunk(Map columns) throws IOException { + public void writeChunk(Map columns) throws IOException { // Adapt each column up front so the map entry point accepts the same shapes as the - // builder: boxed nullable arrays (Long[], Integer[], Boolean[], …) become NullableData, + // builder: boxed nullable arrays (Long[], Integer[], …) become NullableData, // raw primitive arrays pass through. Done before the row-count check so length validation // and encoding both see the normalized carrier. Map adapted = new LinkedHashMap<>(); for (int i = 0; i < schema.fieldNames().size(); i++) { ColumnName colName = schema.fieldNames().get(i); - Object data = columns.get(colName.value()); + Object data = columns.get(colName); if (data == null) { throw new IllegalArgumentException("missing column: " + colName); } diff --git a/writer/src/test/java/io/github/dfa1/vortex/writer/BitpackedEncodingTest.java b/writer/src/test/java/io/github/dfa1/vortex/writer/BitpackedEncodingTest.java index 7a31b23c..08005814 100644 --- a/writer/src/test/java/io/github/dfa1/vortex/writer/BitpackedEncodingTest.java +++ b/writer/src/test/java/io/github/dfa1/vortex/writer/BitpackedEncodingTest.java @@ -42,7 +42,7 @@ void roundTrip_positiveIntegers(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I32_SCHEMA, WriteOptions.defaults(), List.of(new BitpackedEncodingEncoder()))) { // When - sut.writeChunk(Map.of("value", data)); + sut.writeChunk(Map.of(ColumnName.of("value"), data)); } // Then @@ -61,7 +61,7 @@ void roundTrip_allSameValue(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I32_SCHEMA, WriteOptions.defaults(), List.of(new BitpackedEncodingEncoder()))) { // When - sut.writeChunk(Map.of("value", data)); + sut.writeChunk(Map.of(ColumnName.of("value"), data)); } // Then @@ -80,7 +80,7 @@ void roundTrip_negativeIntegers(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I32_SCHEMA, WriteOptions.defaults(), List.of(new BitpackedEncodingEncoder()))) { // When - sut.writeChunk(Map.of("value", data)); + sut.writeChunk(Map.of(ColumnName.of("value"), data)); } // Then @@ -102,8 +102,8 @@ void roundTrip_multipleChunks(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I32_SCHEMA, WriteOptions.defaults(), List.of(new BitpackedEncodingEncoder()))) { // When - sut.writeChunk(Map.of("value", chunk1)); - sut.writeChunk(Map.of("value", chunk2)); + sut.writeChunk(Map.of(ColumnName.of("value"), chunk1)); + sut.writeChunk(Map.of(ColumnName.of("value"), chunk2)); } // Then — read both chunks, each in its own try-with-resources scope @@ -126,7 +126,7 @@ void roundTrip_bitWidths(int maxVal, @TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I32_SCHEMA, WriteOptions.defaults(), List.of(new BitpackedEncodingEncoder()))) { // When - sut.writeChunk(Map.of("value", data)); + sut.writeChunk(Map.of(ColumnName.of("value"), data)); } // Then diff --git a/writer/src/test/java/io/github/dfa1/vortex/writer/ChunkImplTest.java b/writer/src/test/java/io/github/dfa1/vortex/writer/ChunkImplTest.java index f45bdd07..98205880 100644 --- a/writer/src/test/java/io/github/dfa1/vortex/writer/ChunkImplTest.java +++ b/writer/src/test/java/io/github/dfa1/vortex/writer/ChunkImplTest.java @@ -26,7 +26,7 @@ private static DType prim(PType ptype, boolean nullable) { private static Object putGet(DType dtype, Object value) { ChunkImpl sut = new ChunkImpl(schema(dtype)); sut.put(ColumnName.of("c"), value); - return sut.finish().get("c"); + return sut.finish().get(ColumnName.of("c")); } @Nested @@ -85,10 +85,10 @@ void finishReturnsAllColumns() { sut.put(ColumnName.of("c"), col); // When - Map result = sut.finish(); + Map result = sut.finish(); // Then - assertThat(result).containsEntry("c", col); + assertThat(result).containsEntry(ColumnName.of("c"), col); } @Test diff --git a/writer/src/test/java/io/github/dfa1/vortex/writer/ColumnZoneStatsTest.java b/writer/src/test/java/io/github/dfa1/vortex/writer/ColumnZoneStatsTest.java index 1290a7ab..9292f8fd 100644 --- a/writer/src/test/java/io/github/dfa1/vortex/writer/ColumnZoneStatsTest.java +++ b/writer/src/test/java/io/github/dfa1/vortex/writer/ColumnZoneStatsTest.java @@ -40,9 +40,9 @@ private static Path writeThreeChunks(Path tmp) throws IOException { Path file = tmp.resolve("zones.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("id", range(1L, 50L))); - sut.writeChunk(Map.of("id", range(51L, 100L))); - sut.writeChunk(Map.of("id", range(101L, 150L))); + sut.writeChunk(Map.of(ColumnName.of("id"), range(1L, 50L))); + sut.writeChunk(Map.of(ColumnName.of("id"), range(51L, 100L))); + sut.writeChunk(Map.of(ColumnName.of("id"), range(101L, 150L))); } return file; } @@ -108,7 +108,7 @@ void floatColumnZoneSumsAreDoubles(@TempDir Path tmp) throws IOException { Path file = tmp.resolve("f64.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, F64_SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("v", new double[]{1.5, 2.5, 3.0})); + sut.writeChunk(Map.of(ColumnName.of("v"), new double[]{1.5, 2.5, 3.0})); } // When diff --git a/writer/src/test/java/io/github/dfa1/vortex/writer/DeltaEncodingTest.java b/writer/src/test/java/io/github/dfa1/vortex/writer/DeltaEncodingTest.java index 00960cf0..e03cfa4b 100644 --- a/writer/src/test/java/io/github/dfa1/vortex/writer/DeltaEncodingTest.java +++ b/writer/src/test/java/io/github/dfa1/vortex/writer/DeltaEncodingTest.java @@ -44,7 +44,7 @@ void roundTrip_monotonicIncreasing(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I64_SCHEMA, WriteOptions.defaults(), List.of(new DeltaEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -63,7 +63,7 @@ void roundTrip_monotonicDecreasing(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I64_SCHEMA, WriteOptions.defaults(), List.of(new DeltaEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -82,7 +82,7 @@ void roundTrip_allSameValue(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I64_SCHEMA, WriteOptions.defaults(), List.of(new DeltaEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -101,7 +101,7 @@ void roundTrip_singleElement(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I64_SCHEMA, WriteOptions.defaults(), List.of(new DeltaEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -120,7 +120,7 @@ void roundTrip_mixedDeltas(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I64_SCHEMA, WriteOptions.defaults(), List.of(new DeltaEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then @@ -142,8 +142,8 @@ void roundTrip_multipleChunks(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, I64_SCHEMA, WriteOptions.defaults(), List.of(new DeltaEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", chunk1)); - sut.writeChunk(Map.of("ts", chunk2)); + sut.writeChunk(Map.of(ColumnName.of("ts"), chunk1)); + sut.writeChunk(Map.of(ColumnName.of("ts"), chunk2)); } // Then @@ -167,7 +167,7 @@ void roundTrip_sequentialTimestamps(int n, @TempDir Path tmp) throws IOException var sut = VortexWriter.create(ch, I64_SCHEMA, WriteOptions.defaults(), List.of(new DeltaEncodingEncoder()))) { // When - sut.writeChunk(Map.of("ts", data)); + sut.writeChunk(Map.of(ColumnName.of("ts"), data)); } // Then diff --git a/writer/src/test/java/io/github/dfa1/vortex/writer/DictEncodingTest.java b/writer/src/test/java/io/github/dfa1/vortex/writer/DictEncodingTest.java index 7e5b9d7e..b8f8846c 100644 --- a/writer/src/test/java/io/github/dfa1/vortex/writer/DictEncodingTest.java +++ b/writer/src/test/java/io/github/dfa1/vortex/writer/DictEncodingTest.java @@ -47,7 +47,7 @@ void roundTrip_lowCardinality_valuesExpandCorrectly(@TempDir Path tmp) throws IO var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults(), List.of(new DictEncodingEncoder()))) { // When - sut.writeChunk(Map.of("category", data)); + sut.writeChunk(Map.of(ColumnName.of("category"), data)); } // Then @@ -68,7 +68,7 @@ void roundTrip_singleUniqueValue_u8Codes(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults(), List.of(new DictEncodingEncoder()))) { // When - sut.writeChunk(Map.of("category", data)); + sut.writeChunk(Map.of(ColumnName.of("category"), data)); } // Then @@ -88,8 +88,8 @@ void roundTrip_multipleChunks(@TempDir Path tmp) throws IOException { var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults(), List.of(new DictEncodingEncoder()))) { // When - sut.writeChunk(Map.of("category", chunk1)); - sut.writeChunk(Map.of("category", chunk2)); + sut.writeChunk(Map.of(ColumnName.of("category"), chunk1)); + sut.writeChunk(Map.of(ColumnName.of("category"), chunk2)); } // Then — process each chunk inside try-with-resources; arena released after close() diff --git a/writer/src/test/java/io/github/dfa1/vortex/writer/GlobalDictF64Test.java b/writer/src/test/java/io/github/dfa1/vortex/writer/GlobalDictF64Test.java index 5bee6b9d..5a76cc95 100644 --- a/writer/src/test/java/io/github/dfa1/vortex/writer/GlobalDictF64Test.java +++ b/writer/src/test/java/io/github/dfa1/vortex/writer/GlobalDictF64Test.java @@ -49,7 +49,7 @@ void lowCardinality_f64_acrossChunks_usesGlobalDict(@TempDir Path tmp) throws IO // 95% dominant (0.5), 5% scattered across the other 7 values data[i] = (i % 20 == 0) ? dict[1 + ((c + i) % 7)] : dict[0]; } - sut.writeChunk(Map.of("rate", data)); + sut.writeChunk(Map.of(ColumnName.of("rate"), data)); } } @@ -86,7 +86,7 @@ void highCardinality_f64_fallsBackToPerChunk(@TempDir Path tmp) throws IOExcepti try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.cascading(3))) { // When - sut.writeChunk(Map.of("rate", data)); + sut.writeChunk(Map.of(ColumnName.of("rate"), data)); } // Then — correctness only; the dict path must give up cleanly when cardinality > cap. diff --git a/writer/src/test/java/io/github/dfa1/vortex/writer/GlobalDictPrimitiveTest.java b/writer/src/test/java/io/github/dfa1/vortex/writer/GlobalDictPrimitiveTest.java index c9b29100..a81bd503 100644 --- a/writer/src/test/java/io/github/dfa1/vortex/writer/GlobalDictPrimitiveTest.java +++ b/writer/src/test/java/io/github/dfa1/vortex/writer/GlobalDictPrimitiveTest.java @@ -33,7 +33,7 @@ private static long[] writeI64(Path file, long[][] chunks, WriteOptions options) try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, i64Schema(), options)) { for (long[] chunk : chunks) { - sut.writeChunk(Map.of("v", chunk)); + sut.writeChunk(Map.of(ColumnName.of("v"), chunk)); } } try (var vf = VortexReader.open(file, ReadRegistry.loadAll())) { @@ -155,7 +155,7 @@ void lowCardinality_i32_usesGlobalDict(@TempDir Path tmp) throws IOException { Path file = tmp.resolve("i32.vortex"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.cascading(3))) { - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // When @@ -180,7 +180,7 @@ void lowCardinality_i16_notDicted_roundTrips(@TempDir Path tmp) throws IOExcepti Path file = tmp.resolve("i16.vortex"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.cascading(3))) { - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // When — I16 now encodes via the cascade (a ShortArray view), not a dict @@ -221,7 +221,7 @@ void lowCardinality_f64_usesGlobalDict(@TempDir Path tmp) throws IOException { double[] result; try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.cascading(3))) { - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } try (var vf = VortexReader.open(file, ReadRegistry.loadAll())) { result = readAllDoubles(vf, "v"); diff --git a/writer/src/test/java/io/github/dfa1/vortex/writer/GlobalDictUtf8Test.java b/writer/src/test/java/io/github/dfa1/vortex/writer/GlobalDictUtf8Test.java index 2004ed4e..80f762fa 100644 --- a/writer/src/test/java/io/github/dfa1/vortex/writer/GlobalDictUtf8Test.java +++ b/writer/src/test/java/io/github/dfa1/vortex/writer/GlobalDictUtf8Test.java @@ -44,7 +44,7 @@ void lowCardinality_utf8_acrossChunks_usesGlobalDict(@TempDir Path tmp) throws I for (int i = 0; i < rowsPerChunk; i++) { data[i] = dict[(c + i) % dict.length]; } - sut.writeChunk(Map.of("status", data)); + sut.writeChunk(Map.of(ColumnName.of("status"), data)); } } @@ -79,7 +79,7 @@ void highCardinality_utf8_fallsBackToPerChunk(@TempDir Path tmp) throws IOExcept try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.cascading(3))) { // When - sut.writeChunk(Map.of("status", data)); + sut.writeChunk(Map.of(ColumnName.of("status"), data)); } // Then — file is readable, all rows round-trip (correctness, not size). @@ -107,7 +107,7 @@ void mediumCardinality_utf8_usesU16Codes(@TempDir Path tmp) throws IOException { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.cascading(3))) { - sut.writeChunk(Map.of("status", data)); + sut.writeChunk(Map.of(ColumnName.of("status"), data)); } // Then — every value round-trips through the U16-coded dict @@ -135,8 +135,8 @@ void cardinalityExceededAcrossChunks_utf8_fallsBackToPerChunk(@TempDir Path tmp) try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.cascading(3))) { // When — 400 + 1700 = 2100 distinct > 2048 - sut.writeChunk(Map.of("status", c0)); - sut.writeChunk(Map.of("status", c1)); + sut.writeChunk(Map.of(ColumnName.of("status"), c0)); + sut.writeChunk(Map.of(ColumnName.of("status"), c1)); } // Then — the fallback round-trips both chunks in order @@ -161,7 +161,7 @@ void utf8_globalDict_disabled_byOptions(@TempDir Path tmp) throws IOException { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.cascading(3).withGlobalDict(false))) { // When - sut.writeChunk(Map.of("status", data)); + sut.writeChunk(Map.of(ColumnName.of("status"), data)); } // Then diff --git a/writer/src/test/java/io/github/dfa1/vortex/writer/MultiChunkUtf8RoundTripTest.java b/writer/src/test/java/io/github/dfa1/vortex/writer/MultiChunkUtf8RoundTripTest.java index 401d3a1d..c4dd6032 100644 --- a/writer/src/test/java/io/github/dfa1/vortex/writer/MultiChunkUtf8RoundTripTest.java +++ b/writer/src/test/java/io/github/dfa1/vortex/writer/MultiChunkUtf8RoundTripTest.java @@ -47,7 +47,7 @@ void manyBatchesUtf8WithCascading_columnIsChunkedMode(@TempDir Path tmp) throws for (int r = 0; r < perBatch; r++) { batch[r] = "row-" + b + "-" + r; } - sut.writeChunk(Map.of("s", batch)); + sut.writeChunk(Map.of(ColumnName.of("s"), batch)); } } @@ -88,7 +88,7 @@ void scanAll_singleChunkPerWrite_isMaterializedNotChunked(@TempDir Path tmp) thr String[] strings = {"foo", "bar", "baz"}; try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, STRING_SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("s", strings)); + sut.writeChunk(Map.of(ColumnName.of("s"), strings)); } // Then — column should be a leaf VarBinArray (OffsetMode or DictMode), not ChunkedMode diff --git a/writer/src/test/java/io/github/dfa1/vortex/writer/NullCountPruningTest.java b/writer/src/test/java/io/github/dfa1/vortex/writer/NullCountPruningTest.java index 994c8e46..3ac1b605 100644 --- a/writer/src/test/java/io/github/dfa1/vortex/writer/NullCountPruningTest.java +++ b/writer/src/test/java/io/github/dfa1/vortex/writer/NullCountPruningTest.java @@ -36,11 +36,11 @@ private Path write() throws IOException { WriteOptions opts = new WriteOptions(1024, true, 0.90, 0, false, false); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, opts)) { - sut.writeChunk(Map.of("v", new NullableData( + sut.writeChunk(Map.of(ColumnName.of("v"), new NullableData( new long[]{1, 2, 3}, new boolean[]{true, true, true}))); - sut.writeChunk(Map.of("v", new NullableData( + sut.writeChunk(Map.of(ColumnName.of("v"), new NullableData( new long[]{4, 0}, new boolean[]{true, false}))); - sut.writeChunk(Map.of("v", new NullableData( + sut.writeChunk(Map.of(ColumnName.of("v"), new NullableData( new long[]{0, 0, 0, 0}, new boolean[]{false, false, false, false}))); } return file; diff --git a/writer/src/test/java/io/github/dfa1/vortex/writer/VortexWriterTest.java b/writer/src/test/java/io/github/dfa1/vortex/writer/VortexWriterTest.java index e02e809d..a58cd6d5 100644 --- a/writer/src/test/java/io/github/dfa1/vortex/writer/VortexWriterTest.java +++ b/writer/src/test/java/io/github/dfa1/vortex/writer/VortexWriterTest.java @@ -67,7 +67,7 @@ void writeSegments_are64ByteAligned(@TempDir Path tmp) throws IOException { for (int c = 0; c < 3; c++) { long[] id = {c * 3L, c * 3L + 1, c * 3L + 2}; double[] value = {c + 0.5, c + 1.5, c + 2.5}; - sut.writeChunk(Map.of("id", id, "value", value)); + sut.writeChunk(Map.of(ColumnName.of("id"), id, ColumnName.of("value"), value)); } } @@ -149,7 +149,7 @@ void writeChunk_autoroutesExtensionCollectionViaSpecExtension(@TempDir Path tmp) // logical Extension wrapper before picking a physical encoding. try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, dateSchema, WriteOptions.defaults())) { - sut.writeChunk(Map.of("birthdays", dates)); + sut.writeChunk(Map.of(ColumnName.of("birthdays"), dates)); } // Then — read back through DateExtension.decodeAll and assert end-to-end equality. @@ -186,7 +186,7 @@ void writeChunk_extensionCollectionColumn_rowCountValidatedAgainstSibling(@TempD // When / Then — both columns are 3 rows, so the chunk is accepted and round-trips try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.defaults())) { - sut.writeChunk(Map.of("birthdays", dates, "id", ids)); + sut.writeChunk(Map.of(ColumnName.of("birthdays"), dates, ColumnName.of("id"), ids)); } try (var vf = VortexReader.open(file, ReadRegistry.loadAll()); var iter = vf.scan(ScanOptions.all())) { @@ -212,7 +212,7 @@ void writeChunk_map_nullablePrimitive_acceptsBoxedArray(@TempDir Path tmp) throw // When try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.defaults())) { - sut.writeChunk(Map.of("v", new Long[]{10L, null, 30L})); + sut.writeChunk(Map.of(ColumnName.of("v"), new Long[]{10L, null, 30L})); } // Then — the masked file is well-formed @@ -227,7 +227,7 @@ void writeChunk_map_nonNullablePrimitive_rejectsBoxedArray(@TempDir Path tmp) th try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { // When / Then - Map boxedColumn = Map.of("id", new Long[]{1L, 2L}); + Map boxedColumn = Map.of(ColumnName.of("id"), new Long[]{1L, 2L}); assertThatThrownBy(() -> sut.writeChunk(boxedColumn)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("non-nullable") @@ -252,7 +252,7 @@ void writeChunk_roundTripsTimeExtension(@TempDir Path tmp) throws IOException { // When try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.defaults())) { - sut.writeChunk(Map.of("clock", times)); + sut.writeChunk(Map.of(ColumnName.of("clock"), times)); } // Then @@ -281,7 +281,7 @@ void writeChunk_roundTripsTimestampExtension(@TempDir Path tmp) throws IOExcepti // When try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.defaults())) { - sut.writeChunk(Map.of("events", instants)); + sut.writeChunk(Map.of(ColumnName.of("events"), instants)); } // Then @@ -305,7 +305,7 @@ void chunkAs_mismatchedDomainType_throws(@TempDir Path tmp) throws IOException { Path file = tmp.resolve("dates2.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, dateSchema, WriteOptions.defaults())) { - sut.writeChunk(Map.of("birthdays", + sut.writeChunk(Map.of(ColumnName.of("birthdays"), List.of(java.time.LocalDate.of(2026, 6, 10)))); } @@ -334,7 +334,7 @@ void writeChunk_roundTripsUuidExtension(@TempDir Path tmp) throws IOException { // When try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.defaults())) { - sut.writeChunk(Map.of("ids", ids)); + sut.writeChunk(Map.of(ColumnName.of("ids"), ids)); } // Then @@ -389,7 +389,7 @@ private static void writeOne(Path file, DType.Struct schema, Object data, WriteO throws IOException { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, options)) { - sut.writeChunk(Map.of(schema.fieldNames().get(0).value(), data)); + sut.writeChunk(Map.of(schema.fieldNames().get(0), data)); } } @@ -400,7 +400,7 @@ void writeChunk_missingColumn_throwsIllegalArgument(@TempDir Path tmp) throws IO try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { // When / Then - Map partialColumns = Map.of("id", new long[]{1L}); + Map partialColumns = Map.of(ColumnName.of("id"), new long[]{1L}); assertThatThrownBy(() -> sut.writeChunk(partialColumns)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("missing column: value"); @@ -419,7 +419,7 @@ void writeAndRead_singleChunk_returnsCorrectRowCount(@TempDir Path tmp) throws I try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("id", ids, "value", vals)); + sut.writeChunk(Map.of(ColumnName.of("id"), ids, ColumnName.of("value"), vals)); } // Then @@ -440,8 +440,8 @@ void writeAndRead_multipleChunks_returnsAllChunks(@TempDir Path tmp) throws IOEx try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("id", new long[]{1L, 2L}, "value", new double[]{1.0, 2.0})); - sut.writeChunk(Map.of("id", new long[]{3L, 4L, 5L}, "value", new double[]{3.0, 4.0, 5.0})); + sut.writeChunk(Map.of(ColumnName.of("id"), new long[]{1L, 2L}, ColumnName.of("value"), new double[]{1.0, 2.0})); + sut.writeChunk(Map.of(ColumnName.of("id"), new long[]{3L, 4L, 5L}, ColumnName.of("value"), new double[]{3.0, 4.0, 5.0})); } // Then @@ -465,7 +465,7 @@ void writeAndRead_idValues_decodedCorrectly(@TempDir Path tmp) throws IOExceptio try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("id", ids, "value", new double[]{0.0, 0.0, 0.0})); + sut.writeChunk(Map.of(ColumnName.of("id"), ids, ColumnName.of("value"), new double[]{0.0, 0.0, 0.0})); } // Then @@ -492,7 +492,7 @@ void scanResult_column_returnsTypedArray(@TempDir Path tmp) throws IOException { try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("id", ids, "value", new double[]{1.0, 2.0, 3.0})); + sut.writeChunk(Map.of(ColumnName.of("id"), ids, ColumnName.of("value"), new double[]{1.0, 2.0, 3.0})); } // When @@ -516,7 +516,7 @@ void scanResult_column_unknownName_throwsVortexException(@TempDir Path tmp) thro try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("id", new long[]{1L}, "value", new double[]{1.0})); + sut.writeChunk(Map.of(ColumnName.of("id"), new long[]{1L}, ColumnName.of("value"), new double[]{1.0})); } // When / Then @@ -540,7 +540,7 @@ void writeAndRead_columnProjection_returnsOnlyRequestedColumns(@TempDir Path tmp try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { // When - sut.writeChunk(Map.of("id", new long[]{1L}, "value", new double[]{9.9})); + sut.writeChunk(Map.of(ColumnName.of("id"), new long[]{1L}, ColumnName.of("value"), new double[]{9.9})); } // Then @@ -569,7 +569,7 @@ void create_withFullRegistry_roundTrips(@TempDir Path tmp) throws IOException { // When try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, WriteOptions.defaults(), WriteRegistry.loadAll())) { - sut.writeChunk(Map.of("v", data)); + sut.writeChunk(Map.of(ColumnName.of("v"), data)); } // Then diff --git a/writer/src/test/java/io/github/dfa1/vortex/writer/WriterZoneMapTest.java b/writer/src/test/java/io/github/dfa1/vortex/writer/WriterZoneMapTest.java index 86e77e1e..a5bf90f5 100644 --- a/writer/src/test/java/io/github/dfa1/vortex/writer/WriterZoneMapTest.java +++ b/writer/src/test/java/io/github/dfa1/vortex/writer/WriterZoneMapTest.java @@ -49,7 +49,7 @@ private static Path write(Path tmp, boolean zoneMaps) throws IOException { for (int i = 0; i < 4; i++) { v[i] = z * 4L + i; } - sut.writeChunk(Map.of("v", v)); + sut.writeChunk(Map.of(ColumnName.of("v"), v)); } } return file; @@ -143,9 +143,9 @@ void zoneMaps_nullableColumn_recordsPerZoneNullCount(@TempDir Path tmp) throws I Path file = tmp.resolve("nullable.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, opts)) { - sut.writeChunk(Map.of("v", new io.github.dfa1.vortex.writer.encode.NullableData( + sut.writeChunk(Map.of(ColumnName.of("v"), new io.github.dfa1.vortex.writer.encode.NullableData( new long[]{10L, 0L}, new boolean[]{true, false}))); - sut.writeChunk(Map.of("v", new io.github.dfa1.vortex.writer.encode.NullableData( + sut.writeChunk(Map.of(ColumnName.of("v"), new io.github.dfa1.vortex.writer.encode.NullableData( new long[]{0L, 0L}, new boolean[]{false, false}))); } @@ -180,8 +180,8 @@ void everyPrimitiveType_emitsZonedLayout(PType ptype, @TempDir Path tmp) throws Path file = tmp.resolve("ptype-" + ptype + ".vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, opts)) { - sut.writeChunk(Map.of("v", sample(ptype, 0))); - sut.writeChunk(Map.of("v", sample(ptype, 2))); + sut.writeChunk(Map.of(ColumnName.of("v"), sample(ptype, 0))); + sut.writeChunk(Map.of(ColumnName.of("v"), sample(ptype, 2))); } // When / Then @@ -221,8 +221,8 @@ void chunkWithoutStats_emitsNullCountOnlyZoneMap(@TempDir Path tmp) throws IOExc Path file = tmp.resolve("partial.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, opts)) { - sut.writeChunk(Map.of("v", new long[]{1L, 2L})); - sut.writeChunk(Map.of("v", new long[]{})); + sut.writeChunk(Map.of(ColumnName.of("v"), new long[]{1L, 2L})); + sut.writeChunk(Map.of(ColumnName.of("v"), new long[]{})); } // When / Then — zoned with the SUM+NULL_COUNT bitset (bits 5+6 = 0x60), no MIN/MAX @@ -245,8 +245,8 @@ void utf8Column_emitsStringMinMaxZoneMap(@TempDir Path tmp) throws IOException { Path file = tmp.resolve("utf8.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, opts)) { - sut.writeChunk(Map.of("s", new String[]{"apple", "banana"})); - sut.writeChunk(Map.of("s", new String[]{"cherry", "date"})); + sut.writeChunk(Map.of(ColumnName.of("s"), new String[]{"apple", "banana"})); + sut.writeChunk(Map.of(ColumnName.of("s"), new String[]{"cherry", "date"})); } // When / Then the column is zoned with MAX+MIN+NULL_COUNT and string min/max decode per zone @@ -283,8 +283,8 @@ void extensionColumn_emitsStorageMinMaxZoneMap(@TempDir Path tmp) throws IOExcep Path file = tmp.resolve("ext.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, opts)) { - sut.writeChunk(Map.of("t", new long[]{10, 11})); - sut.writeChunk(Map.of("t", new long[]{20, 21})); + sut.writeChunk(Map.of(ColumnName.of("t"), new long[]{10, 11})); + sut.writeChunk(Map.of(ColumnName.of("t"), new long[]{20, 21})); } // When / Then the column is zoned with MAX+MIN+NULL_COUNT and the stats decode per zone @@ -320,8 +320,8 @@ void dictColumn_emitsStringMinMaxZoneMapWrappingDict(@TempDir Path tmp) throws I Path file = tmp.resolve("dict.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, opts)) { - sut.writeChunk(Map.of("s", new String[]{"a", "a", "a", "b", "b", "b"})); - sut.writeChunk(Map.of("s", new String[]{"c", "c", "c", "a", "a", "a"})); + sut.writeChunk(Map.of(ColumnName.of("s"), new String[]{"a", "a", "a", "b", "b", "b"})); + sut.writeChunk(Map.of(ColumnName.of("s"), new String[]{"c", "c", "c", "a", "a", "a"})); } // When / Then — zoned over a dict data child, MAX+MIN+NULL_COUNT, string min/max per zone @@ -357,8 +357,8 @@ void primitiveDictColumn_emitsNumericMinMaxZoneMapWrappingDict(@TempDir Path tmp Path file = tmp.resolve("primdict.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, opts)) { - sut.writeChunk(Map.of("v", new long[]{1, 1, 1, 2, 2, 2})); - sut.writeChunk(Map.of("v", new long[]{3, 3, 3, 1, 1, 1})); + sut.writeChunk(Map.of(ColumnName.of("v"), new long[]{1, 1, 1, 2, 2, 2})); + sut.writeChunk(Map.of(ColumnName.of("v"), new long[]{3, 3, 3, 1, 1, 1})); } // When / Then — zoned over a dict child with MAX+MIN+NULL_COUNT, numeric min/max per zone @@ -402,7 +402,7 @@ void zoneMaps_f64StatsPayloadDecodesPerZoneMinMaxSum(@TempDir Path tmp) throws I for (int i = 0; i < 4; i++) { v[i] = z * 4.0 + i + 0.5; } - sut.writeChunk(Map.of("v", v)); + sut.writeChunk(Map.of(ColumnName.of("v"), v)); } } @@ -438,8 +438,8 @@ void zoneMaps_perTypeStatsDecodePerZoneMinMax(PType ptype, @TempDir Path tmp) th Path file = tmp.resolve("ptype-stats-" + ptype + ".vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, schema, opts)) { - sut.writeChunk(Map.of("v", sample(ptype, 0))); - sut.writeChunk(Map.of("v", sample(ptype, 2))); + sut.writeChunk(Map.of(ColumnName.of("v"), sample(ptype, 0))); + sut.writeChunk(Map.of(ColumnName.of("v"), sample(ptype, 2))); } // When / Then min/max per zone match the source diff --git a/writer/src/test/java/io/github/dfa1/vortex/writer/ZoneMapPruningTest.java b/writer/src/test/java/io/github/dfa1/vortex/writer/ZoneMapPruningTest.java index 258c7cad..1a9ab1f5 100644 --- a/writer/src/test/java/io/github/dfa1/vortex/writer/ZoneMapPruningTest.java +++ b/writer/src/test/java/io/github/dfa1/vortex/writer/ZoneMapPruningTest.java @@ -52,9 +52,9 @@ private static Path writeThreeChunks(Path tmp) throws IOException { Path file = tmp.resolve("three_chunks.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("id", range(1L, 50L))); - sut.writeChunk(Map.of("id", range(51L, 100L))); - sut.writeChunk(Map.of("id", range(101L, 150L))); + sut.writeChunk(Map.of(ColumnName.of("id"), range(1L, 50L))); + sut.writeChunk(Map.of(ColumnName.of("id"), range(51L, 100L))); + sut.writeChunk(Map.of(ColumnName.of("id"), range(101L, 150L))); } return file; } @@ -83,7 +83,7 @@ private static Path writeI64Chunk(Path tmp, long... values) throws IOException { Path file = tmp.resolve("i64_one.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("id", values)); + sut.writeChunk(Map.of(ColumnName.of("id"), values)); } return file; } @@ -108,8 +108,8 @@ private static Path writeU64Chunks(Path tmp) throws IOException { Path file = tmp.resolve("u64_chunks.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, U64_SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("id", range(10L, 20L))); // [10..20], 11 rows - sut.writeChunk(Map.of("id", urange(TWO_POW_63 + 10, 11))); // [2^63+10 .. 2^63+20], 11 rows + sut.writeChunk(Map.of(ColumnName.of("id"), range(10L, 20L))); // [10..20], 11 rows + sut.writeChunk(Map.of(ColumnName.of("id"), urange(TWO_POW_63 + 10, 11))); // [2^63+10 .. 2^63+20], 11 rows } return file; } @@ -128,9 +128,9 @@ private static Path writeF32Chunks(Path tmp) throws IOException { Path file = tmp.resolve("f32_chunks.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var sut = VortexWriter.create(ch, F32_SCHEMA, WriteOptions.defaults())) { - sut.writeChunk(Map.of("v", f32range(1, 50))); - sut.writeChunk(Map.of("v", f32range(51, 100))); - sut.writeChunk(Map.of("v", f32range(101, 150))); + sut.writeChunk(Map.of(ColumnName.of("v"), f32range(1, 50))); + sut.writeChunk(Map.of(ColumnName.of("v"), f32range(51, 100))); + sut.writeChunk(Map.of(ColumnName.of("v"), f32range(101, 150))); } return file; } diff --git a/writer/src/test/java/io/github/dfa1/vortex/writer/ZoneReducerTest.java b/writer/src/test/java/io/github/dfa1/vortex/writer/ZoneReducerTest.java index bd44a816..bce2efbe 100644 --- a/writer/src/test/java/io/github/dfa1/vortex/writer/ZoneReducerTest.java +++ b/writer/src/test/java/io/github/dfa1/vortex/writer/ZoneReducerTest.java @@ -46,9 +46,9 @@ void integerSumFoldsZonesToExactLong(@TempDir Path tmp) throws IOException { Path file = tmp.resolve("ints.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var w = VortexWriter.create(ch, I64_SCHEMA, WriteOptions.defaults())) { - w.writeChunk(Map.of("id", range(1L, 50L))); - w.writeChunk(Map.of("id", range(51L, 100L))); - w.writeChunk(Map.of("id", range(101L, 150L))); + w.writeChunk(Map.of(ColumnName.of("id"), range(1L, 50L))); + w.writeChunk(Map.of(ColumnName.of("id"), range(51L, 100L))); + w.writeChunk(Map.of(ColumnName.of("id"), range(101L, 150L))); } // When @@ -66,7 +66,7 @@ void floatSumFoldsZonesToDouble(@TempDir Path tmp) throws IOException { Path file = tmp.resolve("floats.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var w = VortexWriter.create(ch, F64_SCHEMA, WriteOptions.defaults())) { - w.writeChunk(Map.of("v", new double[]{1.5, 2.5, 3.0})); + w.writeChunk(Map.of(ColumnName.of("v"), new double[]{1.5, 2.5, 3.0})); } // When @@ -85,7 +85,7 @@ void noZoneMapYieldsNull(@TempDir Path tmp) throws IOException { WriteOptions noZoneMaps = WriteOptions.defaults().withZoneMaps(false); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var w = VortexWriter.create(ch, I64_SCHEMA, noZoneMaps)) { - w.writeChunk(Map.of("id", range(1L, 50L))); + w.writeChunk(Map.of(ColumnName.of("id"), range(1L, 50L))); } // When @@ -105,8 +105,8 @@ void overflowedZoneYieldsNull(@TempDir Path tmp) throws IOException { Path file = tmp.resolve("overflow.vtx"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE, StandardOpenOption.WRITE); var w = VortexWriter.create(ch, I64_SCHEMA, WriteOptions.defaults())) { - w.writeChunk(Map.of("id", range(1L, 50L))); // sums fine - w.writeChunk(Map.of("id", new long[]{Long.MAX_VALUE, Long.MAX_VALUE})); // overflows + w.writeChunk(Map.of(ColumnName.of("id"), range(1L, 50L))); // sums fine + w.writeChunk(Map.of(ColumnName.of("id"), new long[]{Long.MAX_VALUE, Long.MAX_VALUE})); // overflows } // When