Skip to content

Commit 4e8f344

Browse files
committed
Remove reflection based vector API detection
Now that the vector API is a hard requirement, we can avoid probing for its presence based on reflection.
1 parent bc028fd commit 4e8f344

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

lib/trino-parquet/src/main/java/io/trino/parquet/reader/ColumnReaderFactory.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import io.trino.spi.type.TimestampWithTimeZoneType;
3333
import io.trino.spi.type.Type;
3434
import io.trino.spi.type.VarcharType;
35+
import jdk.incubator.vector.VectorShape;
3536
import org.apache.parquet.schema.LogicalTypeAnnotation;
3637
import org.apache.parquet.schema.LogicalTypeAnnotation.DateLogicalTypeAnnotation;
3738
import org.apache.parquet.schema.LogicalTypeAnnotation.DecimalLogicalTypeAnnotation;
@@ -84,7 +85,7 @@
8485

8586
public final class ColumnReaderFactory
8687
{
87-
private static final int PREFERRED_BIT_WIDTH = getVectorBitSize();
88+
private static final int PREFERRED_BIT_WIDTH = VectorShape.preferredShape().vectorBitSize();
8889

8990
private final DateTimeZone timeZone;
9091
private final boolean vectorizedDecodingEnabled;
@@ -372,16 +373,4 @@ private static boolean isVectorizedDecodingSupported()
372373
// Graviton 2 machines return false here, whereas x86 and Graviton 3 machines return true
373374
return PREFERRED_BIT_WIDTH >= 256;
374375
}
375-
376-
// get VectorShape bit size via reflection to avoid requiring the preview feature is enabled
377-
private static int getVectorBitSize()
378-
{
379-
try {
380-
Class<?> clazz = Class.forName("jdk.incubator.vector.VectorShape");
381-
return (int) clazz.getMethod("vectorBitSize").invoke(clazz.getMethod("preferredShape").invoke(null));
382-
}
383-
catch (Throwable e) {
384-
return -1;
385-
}
386-
}
387376
}

0 commit comments

Comments
 (0)