@@ -157,7 +157,8 @@ public double jniReadClose() throws IOException {
157157 }
158158
159159 /// Java read: project on "close", sum all values.
160- @ Benchmark
160+ /// NOTE: requires vortex.alp decoder (#7d); disabled until implemented.
161+ // @Benchmark
161162 public double javaReadClose () throws IOException {
162163 var layout = ValueLayout .JAVA_DOUBLE_UNALIGNED .withOrder (ByteOrder .LITTLE_ENDIAN );
163164 double sum = 0.0 ;
@@ -176,6 +177,52 @@ public double javaReadClose() throws IOException {
176177 return sum ;
177178 }
178179
180+ /// JNI read: project on "volume", sum all values.
181+ @ Benchmark
182+ public long jniReadVolume () throws IOException {
183+ String uri = benchFile .toAbsolutePath ().toUri ().toString ();
184+ var opts = ScanOptions .builder ()
185+ .projection (Expression .select (new String []{"volume" }, Expression .root ()))
186+ .build ();
187+
188+ long sum = 0L ;
189+ DataSource ds = DataSource .open (SESSION , uri );
190+ Scan scan = ds .scan (opts );
191+ while (scan .hasNext ()) {
192+ Partition partition = scan .next ();
193+ try (ArrowReader reader = partition .scanArrow (allocator )) {
194+ while (reader .loadNextBatch ()) {
195+ VectorSchemaRoot root = reader .getVectorSchemaRoot ();
196+ BigIntVector volumeVec = (BigIntVector ) root .getVector ("volume" );
197+ for (int i = 0 ; i < root .getRowCount (); i ++) {
198+ sum += volumeVec .get (i );
199+ }
200+ }
201+ }
202+ }
203+ return sum ;
204+ }
205+
206+ /// Java read: project on "volume", sum all values.
207+ @ Benchmark
208+ public long javaReadVolume () throws IOException {
209+ var layout = ValueLayout .JAVA_LONG_UNALIGNED .withOrder (ByteOrder .LITTLE_ENDIAN );
210+ long sum = 0L ;
211+ try (VortexFile vf = VortexFile .open (benchFile , registry )) {
212+ var iter = vf .scan (io .github .dfa1 .vortex .scan .ScanOptions .columns ("volume" ));
213+ while (iter .hasNext ()) {
214+ ScanResult r = iter .next ();
215+ Array arr = r .columns ().get ("volume" );
216+ var buf = arr .buffer (0 );
217+ long len = arr .length ();
218+ for (long j = 0 ; j < len ; j ++) {
219+ sum += buf .get (layout , j * Long .BYTES );
220+ }
221+ }
222+ }
223+ return sum ;
224+ }
225+
179226 // ── JNI file generation ───────────────────────────────────────────────────
180227
181228 private void writeJni (Path path ) throws IOException {
0 commit comments