Skip to content

Commit b3b658b

Browse files
committed
comments
1 parent 7b0df97 commit b3b658b

File tree

10 files changed

+36
-57
lines changed

10 files changed

+36
-57
lines changed

java/build.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ allprojects {
6262

6363
tasks.withType<JavaCompile> {
6464
options.errorprone.disable("UnusedVariable")
65-
// options.compilerArgs.add("--enable-preview")
6665
options.release = 11
6766

6867
// Needed to make sure that the barista-annotations emits to the correct directory

java/vortex-jni/src/main/java/dev/vortex/api/Array.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
*/
1616
package dev.vortex.api;
1717

18-
import java.io.Closeable;
19-
20-
public interface Array extends Closeable {
18+
public interface Array extends AutoCloseable {
2119
long getLen();
2220

2321
DType getDataType();

java/vortex-jni/src/main/java/dev/vortex/api/ArrayStream.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
*/
1616
package dev.vortex.api;
1717

18-
import java.io.Closeable;
19-
20-
public interface ArrayStream extends Closeable {
18+
public interface ArrayStream extends AutoCloseable {
2119
Array getCurrent();
2220

2321
/**

java/vortex-jni/src/main/java/dev/vortex/api/DType.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
1515
*/
1616
package dev.vortex.api;
1717

18-
import com.google.common.collect.ImmutableList;
19-
import java.io.Closeable;
18+
import java.util.List;
2019
import java.util.Optional;
2120

2221
/**
2322
* Vortex logical type.
2423
*/
25-
public interface DType extends Closeable {
24+
public interface DType extends AutoCloseable {
2625

2726
Variant getVariant();
2827

@@ -31,12 +30,12 @@ public interface DType extends Closeable {
3130
/**
3231
* Get the field names for a STRUCT type.
3332
*/
34-
ImmutableList<String> getFieldNames();
33+
List<String> getFieldNames();
3534

3635
/**
3736
* Get the field types for a STRUCT type.
3837
*/
39-
ImmutableList<DType> getFieldTypes();
38+
List<DType> getFieldTypes();
4039

4140
/**
4241
* Get the element type for a LIST type.

java/vortex-jni/src/main/java/dev/vortex/api/File.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
*/
1616
package dev.vortex.api;
1717

18-
import java.io.Closeable;
19-
20-
public interface File extends Closeable {
18+
public interface File extends AutoCloseable {
2119
DType getDType();
2220

2321
ArrayStream newScan(ScanOptions options);

java/vortex-jni/src/main/java/dev/vortex/impl/BaseWrapped.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@
1515
*/
1616
package dev.vortex.impl;
1717

18-
import java.io.Closeable;
19-
2018
/**
2119
* Base class for all objects that are wrappers around some native {@code T} exposed by FFI.
2220
* <p>
2321
* Each wrapped type has a close implementation that will free the native resource.
2422
*/
25-
public abstract class BaseWrapped<T> implements Closeable {
23+
public abstract class BaseWrapped<T> implements AutoCloseable {
2624
protected T inner;
2725

2826
protected BaseWrapped(T inner) {

java/vortex-jni/src/test/java/dev/vortex/jni/FFITest.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717

1818
import static org.junit.jupiter.api.Assertions.assertEquals;
1919

20-
import com.google.common.io.Closer;
2120
import dev.vortex.api.DType;
2221
import dev.vortex.api.ScanOptions;
2322
import dev.vortex.impl.NativeFile;
24-
import java.io.IOException;
2523
import java.nio.file.Path;
2624
import java.nio.file.Paths;
2725
import org.junit.jupiter.api.Test;
@@ -57,18 +55,15 @@ public void testScan() {
5755
.toString();
5856

5957
long rowCount = 0;
60-
try (Closer closer = Closer.create()) {
61-
var file = closer.register(NativeFile.open(path));
62-
var scan = closer.register(file.newScan(ScanOptions.of()));
58+
try (var file = NativeFile.open(path);
59+
var scan = file.newScan(ScanOptions.of())) {
6360

6461
while (scan.next()) {
65-
System.out.println("start batch");
6662
try (var array = scan.getCurrent()) {
6763
rowCount += array.getLen();
6864
}
69-
System.out.println("end batch");
7065
}
71-
} catch (IOException e) {
66+
} catch (Exception e) {
7267
throw new RuntimeException("Failed closing resources", e);
7368
}
7469

java/vortex-spark/src/main/java/dev/vortex/spark/SparkTypes.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static DataType toDataType(DType dType) {
9595
return TimestampType$.MODULE$;
9696
}
9797

98-
// TODO(aduffy): temporal types
98+
// TODO(aduffy): other extension types
9999
throw new IllegalArgumentException("Unsupported non-temporal extension type");
100100
default:
101101
throw new IllegalArgumentException("unreachable");

java/vortex-spark/src/test/java/dev/vortex/spark/VortexScanTest.java

+22-24
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,28 @@ public void testSparkRead() {
5050
}
5151

5252
// Execute the TPC-H queries
53-
var plan = spark.sql(
54-
"""
55-
select
56-
l_returnflag,
57-
l_linestatus,
58-
sum(l_quantity) as sum_qty,
59-
sum(l_extendedprice) as sum_base_price,
60-
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
61-
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
62-
avg(l_quantity) as avg_qty,
63-
avg(l_extendedprice) as avg_price,
64-
avg(l_discount) as avg_disc,
65-
count(*) as count_order
66-
from
67-
lineitem
68-
where
69-
l_shipdate <= date '1998-09-02'
70-
group by
71-
l_returnflag,
72-
l_linestatus
73-
order by
74-
l_returnflag,
75-
l_linestatus
76-
""");
53+
var q1 = "select\n" + " l_returnflag,\n"
54+
+ " l_linestatus,\n"
55+
+ " sum(l_quantity) as sum_qty,\n"
56+
+ " sum(l_extendedprice) as sum_base_price,\n"
57+
+ " sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,\n"
58+
+ " sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,\n"
59+
+ " avg(l_quantity) as avg_qty,\n"
60+
+ " avg(l_extendedprice) as avg_price,\n"
61+
+ " avg(l_discount) as avg_disc,\n"
62+
+ " count(*) as count_order\n"
63+
+ "from\n"
64+
+ " lineitem\n"
65+
+ "where\n"
66+
+ " l_shipdate <= date '1998-09-02'\n"
67+
+ "group by\n"
68+
+ " l_returnflag,\n"
69+
+ " l_linestatus\n"
70+
+ "order by\n"
71+
+ " l_returnflag,\n"
72+
+ " l_linestatus\n";
73+
74+
var plan = spark.sql(q1);
7775

7876
long start = System.nanoTime();
7977
var results = plan.collectAsList();

vortex-ffi/src/file.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,8 @@ pub unsafe extern "C" fn File_dtype(file: *const FFIFile) -> *const DType {
4747

4848
/// Build a new Scan that will stream batches of `FFIArray` from the file.
4949
#[unsafe(no_mangle)]
50-
pub unsafe extern "C" fn File_scan(
51-
file: *const FFIFile,
52-
// options: Option<*const FFIFileScanOptions>,
53-
) -> *mut FFIArrayStream {
54-
// We can say there are a specific set of of row indices to provide instead.
55-
50+
pub unsafe extern "C" fn File_scan(file: *const FFIFile) -> *mut FFIArrayStream {
51+
// TODO(aduffy): pass ScanOptions to projection, filter predicate, etc.
5652
let file = unsafe { &*file };
5753
let stream = file
5854
.inner

0 commit comments

Comments
 (0)