diff --git a/core/trino-main/src/test/java/io/trino/SequencePageBuilder.java b/core/trino-main/src/test/java/io/trino/SequencePageBuilder.java index 947b8619ac0d..a1a2991ffee8 100644 --- a/core/trino-main/src/test/java/io/trino/SequencePageBuilder.java +++ b/core/trino-main/src/test/java/io/trino/SequencePageBuilder.java @@ -25,8 +25,6 @@ import static io.trino.spi.type.BigintType.BIGINT; import static io.trino.spi.type.BooleanType.BOOLEAN; import static io.trino.spi.type.DateType.DATE; -import static io.trino.spi.type.Decimals.isLongDecimal; -import static io.trino.spi.type.Decimals.isShortDecimal; import static io.trino.spi.type.DoubleType.DOUBLE; import static io.trino.spi.type.RealType.REAL; import static io.trino.spi.type.TimestampType.TIMESTAMP_MILLIS; @@ -69,11 +67,11 @@ else if (type.equals(DATE)) { else if (type.equals(TIMESTAMP_MILLIS)) { blocks[i] = BlockAssertions.createTimestampSequenceBlock(initialValue, initialValue + length); } - else if (isShortDecimal(type)) { - blocks[i] = BlockAssertions.createShortDecimalSequenceBlock(initialValue, initialValue + length, (DecimalType) type); + else if (type instanceof DecimalType decimalType && decimalType.isShort()) { + blocks[i] = BlockAssertions.createShortDecimalSequenceBlock(initialValue, initialValue + length, decimalType); } - else if (isLongDecimal(type)) { - blocks[i] = BlockAssertions.createLongDecimalSequenceBlock(initialValue, initialValue + length, (DecimalType) type); + else if (type instanceof DecimalType decimalType && !decimalType.isShort()) { + blocks[i] = BlockAssertions.createLongDecimalSequenceBlock(initialValue, initialValue + length, decimalType); } else { throw new IllegalStateException("Unsupported type " + type); diff --git a/core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkBlockSerde.java b/core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkBlockSerde.java index f9c0e236e588..e96573992e77 100644 --- a/core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkBlockSerde.java +++ b/core/trino-main/src/test/java/io/trino/execution/buffer/BenchmarkBlockSerde.java @@ -24,7 +24,6 @@ import io.trino.spi.block.BlockBuilder; import io.trino.spi.block.TestingBlockEncodingSerde; import io.trino.spi.type.DecimalType; -import io.trino.spi.type.Decimals; import io.trino.spi.type.Int128; import io.trino.spi.type.RowType; import io.trino.spi.type.SqlDecimal; @@ -242,7 +241,7 @@ private void writeValue(Type type, Object value, BlockBuilder blockBuilder) else if (BIGINT.equals(type)) { BIGINT.writeLong(blockBuilder, ((Number) value).longValue()); } - else if (Decimals.isLongDecimal(type)) { + else if (type instanceof DecimalType decimalType && !decimalType.isShort()) { type.writeObject(blockBuilder, Int128.valueOf(((SqlDecimal) value).toBigDecimal().unscaledValue())); } else if (type instanceof VarcharType) { diff --git a/core/trino-spi/src/main/java/io/trino/spi/block/MethodHandleUtil.java b/core/trino-spi/src/main/java/io/trino/spi/block/MethodHandleUtil.java deleted file mode 100644 index 400e6522a105..000000000000 --- a/core/trino-spi/src/main/java/io/trino/spi/block/MethodHandleUtil.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.trino.spi.block; - -import io.trino.spi.TrinoException; -import io.trino.spi.type.Type; - -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodType; - -import static io.trino.spi.StandardErrorCode.GENERIC_INTERNAL_ERROR; -import static java.lang.String.format; - -@Deprecated -public final class MethodHandleUtil -{ - private static final MethodHandle WRITE_LONG = methodHandle(Type.class, "writeLong", BlockBuilder.class, long.class); - private static final MethodHandle WRITE_DOUBLE = methodHandle(Type.class, "writeDouble", BlockBuilder.class, double.class); - private static final MethodHandle WRITE_BOOLEAN = methodHandle(Type.class, "writeBoolean", BlockBuilder.class, boolean.class); - private static final MethodHandle WRITE_OBJECT = methodHandle(Type.class, "writeObject", BlockBuilder.class, Object.class); - - private MethodHandleUtil() - { - } - - /** - * @param f (U, S1, S2, ..., Sm)R - * @param g (T1, T2, ..., Tn)U - * @return (T1, T2, ..., Tn, S1, S2, ..., Sm)R - */ - @Deprecated - public static MethodHandle compose(MethodHandle f, MethodHandle g) - { - if (f.type().parameterType(0) != g.type().returnType()) { - throw new IllegalArgumentException(format("f.parameter(0) != g.return(). f: %s g: %s", f.type(), g.type())); - } - // Semantics: f => f - // Type: (U, S1, S2, ..., Sn)R => (U, T1, T2, ..., Tm, S1, S2, ..., Sn)R - MethodHandle fUTS = MethodHandles.dropArguments(f, 1, g.type().parameterList()); - // Semantics: f => fg - // Type: (U, T1, T2, ..., Tm, S1, S2, ..., Sn)R => (T1, T2, ..., Tm, S1, S2, ..., Sn)R - return MethodHandles.foldArguments(fUTS, g); - } - - /** - * @param f (U, V)R - * @param g (S1, S2, ..., Sm)U - * @param h (T1, T2, ..., Tn)V - * @return (S1, S2, ..., Sm, T1, T2, ..., Tn)R - */ - @Deprecated - public static MethodHandle compose(MethodHandle f, MethodHandle g, MethodHandle h) - { - if (f.type().parameterCount() != 2) { - throw new IllegalArgumentException(format("f.parameterCount != 2. f: %s", f.type())); - } - if (f.type().parameterType(0) != g.type().returnType()) { - throw new IllegalArgumentException(format("f.parameter(0) != g.return. f: %s g: %s", f.type(), g.type())); - } - if (f.type().parameterType(1) != h.type().returnType()) { - throw new IllegalArgumentException(format("f.parameter(0) != h.return. f: %s h: %s", f.type(), h.type())); - } - - // (V, T1, T2, ..., Tn, U)R - MethodType typeVTU = f.type().dropParameterTypes(0, 1).appendParameterTypes(h.type().parameterList()).appendParameterTypes(f.type().parameterType(0)); - // Semantics: f => f - // Type: (U, V)R => (V, T1, T2, ..., Tn, U)R - MethodHandle fVTU = MethodHandles.permuteArguments(f, typeVTU, h.type().parameterCount() + 1, 0); - // Semantics: f => fh - // Type: (V, T1, T2, ..., Tn, U)R => (T1, T2, ..., Tn, U)R - MethodHandle fhTU = MethodHandles.foldArguments(fVTU, h); - - // reorder: [m+1, m+2, ..., m+n, 0] - int[] reorder = new int[fhTU.type().parameterCount()]; - for (int i = 0; i < reorder.length - 1; i++) { - reorder[i] = i + 1 + g.type().parameterCount(); - } - reorder[reorder.length - 1] = 0; - - // (U, S1, S2, ..., Sm, T1, T2, ..., Tn)R - MethodType typeUST = f.type().dropParameterTypes(1, 2).appendParameterTypes(g.type().parameterList()).appendParameterTypes(h.type().parameterList()); - // Semantics: f.h => f.h - // Type: (T1, T2, ..., Tn, U)R => (U, S1, S2, ..., Sm, T1, T2, ..., Tn)R - MethodHandle fhUST = MethodHandles.permuteArguments(fhTU, typeUST, reorder); - - // Semantics: fh => fgh - // Type: (U, S1, S2, ..., Sm, T1, T2, ..., Tn)R => (S1, S2, ..., Sm, T1, T2, ..., Tn)R - return MethodHandles.foldArguments(fhUST, g); - } - - /** - * Returns a MethodHandle corresponding to the specified method. - *
- * Warning: The way Oracle JVM implements producing MethodHandle for a method involves creating
- * JNI global weak references. G1 processes such references serially. As a result, calling this
- * method in a tight loop can create significant GC pressure and significantly increase
- * application pause time.
- */
- @Deprecated
- public static MethodHandle methodHandle(Class> clazz, String name, Class>... parameterTypes)
- {
- try {
- return MethodHandles.lookup().unreflect(clazz.getMethod(name, parameterTypes));
- }
- catch (IllegalAccessException | NoSuchMethodException e) {
- throw new TrinoException(GENERIC_INTERNAL_ERROR, e);
- }
- }
-
- @Deprecated
- public static MethodHandle nativeValueWriter(Type type)
- {
- Class> javaType = type.getJavaType();
-
- MethodHandle methodHandle;
- if (javaType == long.class) {
- methodHandle = WRITE_LONG;
- }
- else if (javaType == double.class) {
- methodHandle = WRITE_DOUBLE;
- }
- else if (javaType == boolean.class) {
- methodHandle = WRITE_BOOLEAN;
- }
- else if (!javaType.isPrimitive()) {
- methodHandle = WRITE_OBJECT;
- }
- else {
- throw new IllegalArgumentException("Unknown java type " + javaType + " from type " + type);
- }
-
- return methodHandle.bindTo(type);
- }
-}
diff --git a/core/trino-spi/src/main/java/io/trino/spi/type/Decimals.java b/core/trino-spi/src/main/java/io/trino/spi/type/Decimals.java
index 763e1236235b..ec9af3a84596 100644
--- a/core/trino-spi/src/main/java/io/trino/spi/type/Decimals.java
+++ b/core/trino-spi/src/main/java/io/trino/spi/type/Decimals.java
@@ -259,24 +259,6 @@ public static BigInteger rescale(BigInteger value, int fromScale, int toScale)
return value.multiply(bigIntegerTenToNth(toScale - fromScale));
}
- /**
- * @deprecated Use {@link DecimalType#isShort()}
- */
- @Deprecated
- public static boolean isShortDecimal(Type type)
- {
- return type instanceof ShortDecimalType;
- }
-
- /**
- * @deprecated Use {@link DecimalType#isShort()}
- */
- @Deprecated
- public static boolean isLongDecimal(Type type)
- {
- return type instanceof LongDecimalType;
- }
-
/**
* Converts {@link BigDecimal} to {@link Int128} representing it for long {@link DecimalType}.
* It is caller responsibility to ensure that {@code value.scale()} equals to {@link DecimalType#getScale()}.
diff --git a/core/trino-spi/src/test/java/io/trino/spi/block/TestMethodHandleUtil.java b/core/trino-spi/src/test/java/io/trino/spi/block/TestMethodHandleUtil.java
deleted file mode 100644
index 88e3c0a19cac..000000000000
--- a/core/trino-spi/src/test/java/io/trino/spi/block/TestMethodHandleUtil.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.trino.spi.block;
-
-import org.testng.annotations.Test;
-
-import java.lang.invoke.MethodHandle;
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static io.trino.spi.block.MethodHandleUtil.compose;
-import static io.trino.spi.block.MethodHandleUtil.methodHandle;
-import static org.testng.Assert.assertEquals;
-
-public class TestMethodHandleUtil
-{
- // Each custom type in this test is effectively a number.
- // All method handles in this test returns the product of all input parameters.
- // Each method handles has distinct input types and return type.
-
- // The composed function is invoked once to verify that:
- // * The composed function type is expected
- // * Each argument is multiplied into the product exactly once. (by using prime numbers as input)
-
- @Test
- public void testCompose2()
- throws Throwable
- {
- MethodHandle fUS2R = methodHandle(TestMethodHandleUtil.class, "fUS2R", U.class, S1.class, S2.class);
- MethodHandle fT2U = methodHandle(TestMethodHandleUtil.class, "fT2U", T1.class, T2.class);
- MethodHandle composed = compose(fUS2R, fT2U);
- assertEquals((R) composed.invokeExact(new T1(2), new T2(3), new S1(5), new S2(7)), new R(210));
- }
-
- @Test
- public void testCompose2withoutS()
- throws Throwable
- {
- MethodHandle fU2R = methodHandle(TestMethodHandleUtil.class, "fU2R", U.class);
- MethodHandle fT2U = methodHandle(TestMethodHandleUtil.class, "fT2U", T1.class, T2.class);
- MethodHandle composed = compose(fU2R, fT2U);
- assertEquals((R) composed.invokeExact(new T1(2), new T2(3)), new R(6));
- }
-
- @Test
- public void testCompose3()
- throws Throwable
- {
- MethodHandle fUV2R = methodHandle(TestMethodHandleUtil.class, "fUV2R", U.class, V.class);
- MethodHandle fS2U = methodHandle(TestMethodHandleUtil.class, "fS2U", S1.class, S2.class);
- MethodHandle fT2V = methodHandle(TestMethodHandleUtil.class, "fT2V", T1.class, T2.class);
- MethodHandle composed = compose(fUV2R, fS2U, fT2V);
- assertEquals((R) composed.invokeExact(new S1(2), new S2(3), new T1(5), new T2(7)), new R(210));
- }
-
- public static R fU2R(U u)
- {
- return new R(u.getValue());
- }
-
- public static R fUS2R(U u, S1 s1, S2 s2)
- {
- return new R(u.getValue() * s1.getValue() * s2.getValue());
- }
-
- public static R fUV2R(U u, V v)
- {
- return new R(u.getValue() * v.getValue());
- }
-
- public static U fT2U(T1 t1, T2 t2)
- {
- return new U(t1.getValue() * t2.getValue());
- }
-
- public static U fS2U(S1 s1, S2 s2)
- {
- return new U(s1.getValue() * s2.getValue());
- }
-
- public static V fT2V(T1 t1, T2 t2)
- {
- return new V(t1.getValue() * t2.getValue());
- }
-
- public static String squareBracket(String s)
- {
- return "[" + s + "]";
- }
-
- public static String squareBracket(String s, double d)
- {
- return "[" + s + "," + ((long) d) + "]";
- }
-
- public static String curlyBracket(String s, char c)
- {
- return "{" + s + "=" + c + "}";
- }
-
- public static double sum(long x, int c)
- {
- return (double) x + c;
- }
-
- private static class Base
- {
- private final int value;
-
- public Base(int value)
- {
- this.value = value;
- }
-
- public int getValue()
- {
- return value;
- }
-
- @Override
- public boolean equals(Object o)
- {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- Base base = (Base) o;
- return value == base.value;
- }
-
- @Override
- public int hashCode()
- {
- return Objects.hash(value);
- }
-
- @Override
- public String toString()
- {
- return toStringHelper(this)
- .add("value", value)
- .toString();
- }
- }
-
- private static class U
- extends Base
- {
- public U(int value)
- {
- super(value);
- }
- }
-
- private static class V
- extends Base
- {
- public V(int value)
- {
- super(value);
- }
- }
-
- private static class R
- extends Base
- {
- public R(int value)
- {
- super(value);
- }
- }
-
- private static class S1
- extends Base
- {
- public S1(int value)
- {
- super(value);
- }
- }
-
- private static class S2
- extends Base
- {
- public S2(int value)
- {
- super(value);
- }
- }
-
- private static class T1
- extends Base
- {
- public T1(int value)
- {
- super(value);
- }
- }
-
- private static class T2
- extends Base
- {
- public T2(int value)
- {
- super(value);
- }
- }
-}
diff --git a/lib/trino-orc/src/main/java/io/trino/orc/TupleDomainOrcPredicate.java b/lib/trino-orc/src/main/java/io/trino/orc/TupleDomainOrcPredicate.java
index 80b0d201b46f..af359088658a 100644
--- a/lib/trino-orc/src/main/java/io/trino/orc/TupleDomainOrcPredicate.java
+++ b/lib/trino-orc/src/main/java/io/trino/orc/TupleDomainOrcPredicate.java
@@ -50,8 +50,6 @@
import static io.trino.spi.type.DateTimeEncoding.packDateTimeWithZone;
import static io.trino.spi.type.DateTimeEncoding.unpackMillisUtc;
import static io.trino.spi.type.DateType.DATE;
-import static io.trino.spi.type.Decimals.isLongDecimal;
-import static io.trino.spi.type.Decimals.isShortDecimal;
import static io.trino.spi.type.Decimals.rescale;
import static io.trino.spi.type.DoubleType.DOUBLE;
import static io.trino.spi.type.IntegerType.INTEGER;
@@ -230,11 +228,11 @@ public static Domain getDomain(Type type, long rowCount, ColumnStatistics column
return Domain.create(ValueSet.of(BOOLEAN, false), hasNullValue);
}
}
- else if (isShortDecimal(type) && columnStatistics.getDecimalStatistics() != null) {
- return createDomain(type, hasNullValue, columnStatistics.getDecimalStatistics(), value -> rescale(value, (DecimalType) type).unscaledValue().longValue());
+ else if (type instanceof DecimalType decimalType && decimalType.isShort() && columnStatistics.getDecimalStatistics() != null) {
+ return createDomain(type, hasNullValue, columnStatistics.getDecimalStatistics(), value -> rescale(value, decimalType).unscaledValue().longValue());
}
- else if (isLongDecimal(type) && columnStatistics.getDecimalStatistics() != null) {
- return createDomain(type, hasNullValue, columnStatistics.getDecimalStatistics(), value -> Int128.valueOf(rescale(value, (DecimalType) type).unscaledValue()));
+ else if (type instanceof DecimalType decimalType && !decimalType.isShort() && columnStatistics.getDecimalStatistics() != null) {
+ return createDomain(type, hasNullValue, columnStatistics.getDecimalStatistics(), value -> Int128.valueOf(rescale(value, decimalType).unscaledValue()));
}
else if (type instanceof CharType && columnStatistics.getStringStatistics() != null) {
return createDomain(type, hasNullValue, columnStatistics.getStringStatistics(), value -> truncateToLengthAndTrimSpaces(value, type));
diff --git a/lib/trino-parquet/src/main/java/io/trino/parquet/reader/ShortDecimalColumnReader.java b/lib/trino-parquet/src/main/java/io/trino/parquet/reader/ShortDecimalColumnReader.java
index bd29ed0ef702..7950ca65016d 100644
--- a/lib/trino-parquet/src/main/java/io/trino/parquet/reader/ShortDecimalColumnReader.java
+++ b/lib/trino-parquet/src/main/java/io/trino/parquet/reader/ShortDecimalColumnReader.java
@@ -27,8 +27,6 @@
import static io.trino.spi.type.BigintType.BIGINT;
import static io.trino.spi.type.DecimalConversions.shortToLongCast;
import static io.trino.spi.type.DecimalConversions.shortToShortCast;
-import static io.trino.spi.type.Decimals.isLongDecimal;
-import static io.trino.spi.type.Decimals.isShortDecimal;
import static io.trino.spi.type.Decimals.longTenToNth;
import static io.trino.spi.type.IntegerType.INTEGER;
import static io.trino.spi.type.SmallintType.SMALLINT;
@@ -80,7 +78,7 @@ else if (field.getDescriptor().getPrimitiveType().getPrimitiveTypeName() == INT6
}
if (trinoType instanceof DecimalType trinoDecimalType) {
- if (isShortDecimal(trinoDecimalType)) {
+ if (trinoDecimalType.isShort()) {
long rescale = longTenToNth(Math.abs(trinoDecimalType.getScale() - parquetDecimalType.getScale()));
long convertedValue = shortToShortCast(
value,
@@ -93,7 +91,7 @@ else if (field.getDescriptor().getPrimitiveType().getPrimitiveTypeName() == INT6
trinoType.writeLong(blockBuilder, convertedValue);
}
- else if (isLongDecimal(trinoDecimalType)) {
+ else {
trinoType.writeObject(blockBuilder, shortToLongCast(
value,
parquetDecimalType.getPrecision(),
diff --git a/lib/trino-rcfile/src/test/java/io/trino/rcfile/RcFileTester.java b/lib/trino-rcfile/src/test/java/io/trino/rcfile/RcFileTester.java
index c5ae1cb9d052..d657066f9cd1 100644
--- a/lib/trino-rcfile/src/test/java/io/trino/rcfile/RcFileTester.java
+++ b/lib/trino-rcfile/src/test/java/io/trino/rcfile/RcFileTester.java
@@ -31,7 +31,6 @@
import io.trino.spi.block.BlockBuilder;
import io.trino.spi.type.ArrayType;
import io.trino.spi.type.DecimalType;
-import io.trino.spi.type.Decimals;
import io.trino.spi.type.Int128;
import io.trino.spi.type.MapType;
import io.trino.spi.type.RowType;
@@ -678,10 +677,10 @@ else if (INTEGER.equals(type)) {
else if (BIGINT.equals(type)) {
type.writeLong(blockBuilder, ((Number) value).longValue());
}
- else if (Decimals.isShortDecimal(type)) {
+ else if (type instanceof DecimalType decimalType && decimalType.isShort()) {
type.writeLong(blockBuilder, ((SqlDecimal) value).toBigDecimal().unscaledValue().longValue());
}
- else if (Decimals.isLongDecimal(type)) {
+ else if (type instanceof DecimalType decimalType && !decimalType.isShort()) {
type.writeObject(blockBuilder, Int128.valueOf(((SqlDecimal) value).toBigDecimal().unscaledValue()));
}
else if (REAL.equals(type)) {
diff --git a/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryQueryPageSource.java b/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryQueryPageSource.java
index a980df48a1ca..11daeac84d56 100644
--- a/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryQueryPageSource.java
+++ b/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryQueryPageSource.java
@@ -52,7 +52,6 @@
import static io.trino.spi.StandardErrorCode.GENERIC_INTERNAL_ERROR;
import static io.trino.spi.type.BigintType.BIGINT;
import static io.trino.spi.type.DateType.DATE;
-import static io.trino.spi.type.Decimals.isLongDecimal;
import static io.trino.spi.type.IntegerType.INTEGER;
import static io.trino.spi.type.TimeType.TIME_MICROS;
import static io.trino.spi.type.TimestampType.TIMESTAMP_MICROS;
@@ -200,8 +199,8 @@ else if (javaType == double.class) {
type.writeDouble(output, value.getDoubleValue());
}
else if (type.getJavaType() == Int128.class) {
- verify(isLongDecimal(type), "The type should be long decimal");
DecimalType decimalType = (DecimalType) type;
+ verify(!decimalType.isShort(), "The type should be long decimal");
BigDecimal decimal = value.getNumericValue();
type.writeObject(output, Decimals.encodeScaledValue(decimal, decimalType.getScale()));
}
diff --git a/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryStorageAvroPageSource.java b/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryStorageAvroPageSource.java
index 36542215e494..c6d1e47b100c 100644
--- a/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryStorageAvroPageSource.java
+++ b/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryStorageAvroPageSource.java
@@ -61,7 +61,6 @@
import static io.trino.spi.type.BigintType.BIGINT;
import static io.trino.spi.type.DateType.DATE;
import static io.trino.spi.type.Decimals.encodeShortScaledValue;
-import static io.trino.spi.type.Decimals.isLongDecimal;
import static io.trino.spi.type.IntegerType.INTEGER;
import static io.trino.spi.type.LongTimestampWithTimeZone.fromEpochMillisAndFraction;
import static io.trino.spi.type.TimeType.TIME_MICROS;
@@ -239,7 +238,7 @@ else if (type instanceof VarbinaryType) {
private static void writeObject(BlockBuilder output, Type type, Object value)
{
if (type instanceof DecimalType decimalType) {
- verify(isLongDecimal(type), "The type should be long decimal");
+ verify(!decimalType.isShort(), "The type should be long decimal");
BigDecimal decimal = DECIMAL_CONVERTER.convert(decimalType.getPrecision(), decimalType.getScale(), value);
type.writeObject(output, Decimals.encodeScaledValue(decimal, decimalType.getScale()));
}
diff --git a/plugin/trino-blackhole/src/main/java/io/trino/plugin/blackhole/BlackHoleMetadata.java b/plugin/trino-blackhole/src/main/java/io/trino/plugin/blackhole/BlackHoleMetadata.java
index b66860c72fb5..512ad30ea6d5 100644
--- a/plugin/trino-blackhole/src/main/java/io/trino/plugin/blackhole/BlackHoleMetadata.java
+++ b/plugin/trino-blackhole/src/main/java/io/trino/plugin/blackhole/BlackHoleMetadata.java
@@ -38,6 +38,7 @@
import io.trino.spi.connector.SchemaNotFoundException;
import io.trino.spi.connector.SchemaTableName;
import io.trino.spi.connector.SchemaTablePrefix;
+import io.trino.spi.connector.TableColumnsMetadata;
import io.trino.spi.connector.ViewNotFoundException;
import io.trino.spi.security.TrinoPrincipal;
import io.trino.spi.statistics.ColumnStatistics;
@@ -50,6 +51,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -164,10 +166,17 @@ public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTable
@Override
public Map