Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ private static void verifyJvmRequirements()
verifyOsArchitecture();
verifyByteOrder();
verifyUsingG1Gc();
verifyVectorApiEnabled();
verifyUnixOperatingMBeans();
verifyFileDescriptor();
verifySlice();
Expand Down Expand Up @@ -129,6 +130,13 @@ private static void verifyUsingG1Gc()
}
}

private static void verifyVectorApiEnabled()
{
if (ModuleLayer.boot().findModule("jdk.incubator.vector").isEmpty()) {
failRequirement("Trino requires the Vector API to be enabled/linked at runtime");
}
}

private static void verifyFileDescriptor()
{
long maxFileDescriptorCount = getMaxFileDescriptorCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import io.trino.spi.type.TimestampWithTimeZoneType;
import io.trino.spi.type.Type;
import io.trino.spi.type.VarcharType;
import jdk.incubator.vector.VectorShape;
import org.apache.parquet.schema.LogicalTypeAnnotation;
import org.apache.parquet.schema.LogicalTypeAnnotation.DateLogicalTypeAnnotation;
import org.apache.parquet.schema.LogicalTypeAnnotation.DecimalLogicalTypeAnnotation;
Expand Down Expand Up @@ -84,7 +85,7 @@

public final class ColumnReaderFactory
{
private static final int PREFERRED_BIT_WIDTH = getVectorBitSize();
private static final int PREFERRED_BIT_WIDTH = VectorShape.preferredShape().vectorBitSize();

private final DateTimeZone timeZone;
private final boolean vectorizedDecodingEnabled;
Expand Down Expand Up @@ -372,16 +373,4 @@ private static boolean isVectorizedDecodingSupported()
// Graviton 2 machines return false here, whereas x86 and Graviton 3 machines return true
return PREFERRED_BIT_WIDTH >= 256;
}

// get VectorShape bit size via reflection to avoid requiring the preview feature is enabled
private static int getVectorBitSize()
{
try {
Class<?> clazz = Class.forName("jdk.incubator.vector.VectorShape");
return (int) clazz.getMethod("vectorBitSize").invoke(clazz.getMethod("preferredShape").invoke(null));
}
catch (Throwable e) {
return -1;
}
}
}