This is an automated email from the ASF dual-hosted git repository.
tison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 470b674016c [feat][sql] Bump Trino version to 368 and fix Decimal
breaking change (#20016)
470b674016c is described below
commit 470b674016c8718f2dfd0a0f93cf02d49af0fead
Author: tison <[email protected]>
AuthorDate: Mon Apr 10 15:06:33 2023 +0800
[feat][sql] Bump Trino version to 368 and fix Decimal breaking change
(#20016)
Signed-off-by: tison <[email protected]>
---
pom.xml | 2 +-
pulsar-sql/pom.xml | 2 +-
pulsar-sql/presto-distribution/LICENSE | 75 ++++++++++++----------
pulsar-sql/presto-distribution/pom.xml | 4 ++
pulsar-sql/presto-pulsar/pom.xml | 7 +-
.../decoder/avro/PulsarAvroColumnDecoder.java | 39 +++++++----
.../decoder/json/PulsarJsonFieldDecoder.java | 49 +++++++++-----
.../decoder/json/PulsarJsonRowDecoderFactory.java | 14 ++--
.../pulsar/sql/presto/decoder/DecoderTestUtil.java | 19 +++---
.../sql/presto/decoder/avro/TestAvroDecoder.java | 36 +++++------
10 files changed, 145 insertions(+), 102 deletions(-)
diff --git a/pom.xml b/pom.xml
index 4534036f3fd..7f20d478594 100644
--- a/pom.xml
+++ b/pom.xml
@@ -184,7 +184,7 @@ flexible messaging model and an intuitive client
API.</description>
<json-smart.version>2.4.10</json-smart.version>
<opensearch.version>1.2.4</opensearch.version>
<elasticsearch-java.version>8.5.2</elasticsearch-java.version>
- <trino.version>363</trino.version>
+ <trino.version>368</trino.version>
<debezium.version>1.9.7.Final</debezium.version>
<debezium.postgresql.version>42.5.0</debezium.postgresql.version>
<debezium.mysql.version>8.0.30</debezium.mysql.version>
diff --git a/pulsar-sql/pom.xml b/pulsar-sql/pom.xml
index 4dbf7d57373..1f8972bf222 100644
--- a/pulsar-sql/pom.xml
+++ b/pulsar-sql/pom.xml
@@ -36,7 +36,7 @@
<okhttp3.version>3.14.9</okhttp3.version>
<!-- use okio version that matches the okhttp3 version -->
<okio.version>1.17.2</okio.version>
- <airlift.version>208</airlift.version>
+ <airlift.version>213</airlift.version>
</properties>
<dependencyManagement>
diff --git a/pulsar-sql/presto-distribution/LICENSE
b/pulsar-sql/presto-distribution/LICENSE
index c523fae7606..6d60765d459 100644
--- a/pulsar-sql/presto-distribution/LICENSE
+++ b/pulsar-sql/presto-distribution/LICENSE
@@ -303,28 +303,28 @@ The Apache Software License, Version 2.0
- bytecode-1.2.jar
* Airlift
- aircompressor-0.20.jar
- - bootstrap-208.jar
- - concurrent-208.jar
- - configuration-208.jar
- - discovery-208.jar
+ - bootstrap-213.jar
+ - concurrent-213.jar
+ - configuration-213.jar
+ - discovery-213.jar
- discovery-server-1.30.jar
- - event-208.jar
- - event-http-208.jar
- - http-client-208.jar
- - http-server-208.jar
- - jmx-208.jar
- - jmx-http-208.jar
- - jmx-http-rpc-208.jar
+ - event-213.jar
+ - event-http-213.jar
+ - http-client-213.jar
+ - http-server-213.jar
+ - jmx-213.jar
+ - jmx-http-213.jar
+ - jmx-http-rpc-213.jar
- joni-2.1.5.3.jar
- - json-208.jar
- - log-208.jar
- - log-manager-208.jar
- - node-208.jar
+ - json-213.jar
+ - log-213.jar
+ - log-manager-213.jar
+ - node-213.jar
- parameternames-1.4.jar
- - security-208.jar
- - slice-0.39.jar
- - stats-208.jar
- - trace-token-208.jar
+ - security-213.jar
+ - slice-0.41.jar
+ - stats-213.jar
+ - trace-token-213.jar
- units-1.6.jar
* Apache HTTP Client
- httpclient-4.5.13.jar
@@ -340,7 +340,9 @@ The Apache Software License, Version 2.0
* J2ObjC Annotations
- j2objc-annotations-1.3.jar
* JSON Web Token Support For The JVM
- - jjwt-0.9.0.jar
+ - jjwt-api-0.11.1.jar
+ - jjwt-impl-0.11.1.jar
+ - jjwt-jackson-0.11.1.jar
* Jmxutils
- jmxutils-1.21.jar
* LevelDB
@@ -384,18 +386,18 @@ The Apache Software License, Version 2.0
* Okio
- okio-1.17.2.jar
* Trino
- - trino-array-363.jar
- - trino-cli-363.jar
- - trino-client-363.jar
- - trino-geospatial-toolkit-363.jar
- - trino-main-363.jar
- - trino-matching-363.jar
- - trino-memory-context-363.jar
- - trino-parser-363.jar
- - trino-plugin-toolkit-363.jar
- - trino-server-main-363.jar
- - trino-spi-363.jar
- - trino-record-decoder-363.jar
+ - trino-array-368.jar
+ - trino-cli-368.jar
+ - trino-client-368.jar
+ - trino-geospatial-toolkit-368.jar
+ - trino-main-368.jar
+ - trino-matching-368.jar
+ - trino-memory-context-368.jar
+ - trino-parser-368.jar
+ - trino-plugin-toolkit-368.jar
+ - trino-server-main-368.jar
+ - trino-spi-368.jar
+ - trino-record-decoder-368.jar
* RocksDB JNI
- rocksdbjni-6.29.4.1.jar
* SnakeYAML
@@ -456,6 +458,7 @@ The Apache Software License, Version 2.0
- javassist-3.25.0-GA.jar
* Java Native Access
- jna-5.12.1.jar
+ - jna-platform-5.10.0.jar
* Java Object Layout: Core
- jol-core-0.2.jar
* Yahoo Datasketches
@@ -493,7 +496,7 @@ BSD License
* ANTLR 4 Runtime
- antlr4-runtime-4.9.2.jar
* ASM, a very small and fast Java bytecode manipulation framework
- - asm-6.2.1.jar
+ - asm-9.1.jar
- asm-analysis-6.2.1.jar
- asm-tree-6.2.1.jar
- asm-util-6.2.1.jar
@@ -518,6 +521,8 @@ MIT License
* ScribeJava
- scribejava-apis-6.9.0.jar
- scribejava-core-6.9.0.jar
+ * OSHI
+ - oshi-core-5.8.5.jar
CDDL - 1.0
* OSGi Resource Locator
@@ -533,8 +538,9 @@ CDDL-1.1 -- licenses/LICENSE-CDDL-1.1.txt
- hk2-utils-2.6.1.jar
- aopalliance-repackaged-2.6.1.jar
* Jersey
- - jaxrs-208.jar
+ - jaxrs-213.jar
- jersey-client-2.34.jar
+ - jersey-common-2.34.jar
- jersey-container-servlet-2.34.jar
- jersey-container-servlet-core-2.34.jar
- jersey-entity-filtering-2.34.jar
@@ -542,7 +548,6 @@ CDDL-1.1 -- licenses/LICENSE-CDDL-1.1.txt
- jersey-media-json-jackson-2.34.jar
- jersey-media-multipart-2.34.jar
- jersey-server-2.34.jar
- - jersey-common-2.34.jar
* JAXB
- jaxb-api-2.3.1.jar
- jaxb-runtime-2.3.4.jar
diff --git a/pulsar-sql/presto-distribution/pom.xml
b/pulsar-sql/presto-distribution/pom.xml
index 6e39bd50ad8..48a1bf90662 100644
--- a/pulsar-sql/presto-distribution/pom.xml
+++ b/pulsar-sql/presto-distribution/pom.xml
@@ -97,6 +97,10 @@
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-multibindings</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-to-slf4j</artifactId>
+ </exclusion>
</exclusions>
</dependency>
diff --git a/pulsar-sql/presto-pulsar/pom.xml b/pulsar-sql/presto-pulsar/pom.xml
index 622c66e6d76..e61580f1fcf 100644
--- a/pulsar-sql/presto-pulsar/pom.xml
+++ b/pulsar-sql/presto-pulsar/pom.xml
@@ -41,8 +41,13 @@
<dependency>
<groupId>io.airlift</groupId>
<artifactId>bootstrap</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-to-slf4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
-
<dependency>
<groupId>io.airlift</groupId>
<artifactId>json</artifactId>
diff --git
a/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/decoder/avro/PulsarAvroColumnDecoder.java
b/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/decoder/avro/PulsarAvroColumnDecoder.java
index 4616a603799..73081f8948a 100644
---
a/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/decoder/avro/PulsarAvroColumnDecoder.java
+++
b/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/decoder/avro/PulsarAvroColumnDecoder.java
@@ -41,8 +41,8 @@ import io.trino.spi.type.BigintType;
import io.trino.spi.type.BooleanType;
import io.trino.spi.type.DateType;
import io.trino.spi.type.DecimalType;
-import io.trino.spi.type.Decimals;
import io.trino.spi.type.DoubleType;
+import io.trino.spi.type.Int128;
import io.trino.spi.type.IntegerType;
import io.trino.spi.type.MapType;
import io.trino.spi.type.RealType;
@@ -66,11 +66,14 @@ import org.apache.avro.generic.GenericFixed;
import org.apache.avro.generic.GenericRecord;
/**
- * Copy from {@link io.trino.decoder.avro.AvroColumnDecoder}
(presto-record-decoder-345)
- * with A little bit pulsar's extensions.
- * 1) support {@link io.trino.spi.type.TimestampType},{@link
io.trino.spi.type.DateType}DATE,
- * * {@link io.trino.spi.type.TimeType}.
+ * Copy from {@link io.trino.decoder.avro.AvroColumnDecoder}
+ * with A little pulsar's extensions.
+ * 1) support date and time types.
+ * {@link io.trino.spi.type.TimestampType}
+ * {@link io.trino.spi.type.DateType}
+ * {@link io.trino.spi.type.TimeType}
* 2) support {@link io.trino.spi.type.RealType}.
+ * 3) support {@link io.trino.spi.type.DecimalType}.
*/
public class PulsarAvroColumnDecoder {
private static final Set<Type> SUPPORTED_PRIMITIVE_TYPES = ImmutableSet.of(
@@ -252,13 +255,6 @@ public class PulsarAvroColumnDecoder {
}
}
- // The returned Slice size must be equals to 18 Byte
- if (type instanceof DecimalType) {
- ByteBuffer buffer = (ByteBuffer) value;
- BigInteger bigInteger = new BigInteger(buffer.array());
- return Decimals.encodeUnscaledValue(bigInteger);
- }
-
throw new TrinoException(DECODER_CONVERSION_NOT_SUPPORTED,
format("cannot decode object of '%s' as '%s' for column '%s'",
value.getClass(), type, columnName));
@@ -274,6 +270,9 @@ public class PulsarAvroColumnDecoder {
if (type instanceof RowType) {
return serializeRow(builder, value, type, columnName);
}
+ if (type instanceof DecimalType && !((DecimalType) type).isShort()) {
+ return serializeLongDecimal(builder, value, type, columnName);
+ }
serializePrimitive(builder, value, type, columnName);
return null;
}
@@ -299,6 +298,22 @@ public class PulsarAvroColumnDecoder {
return blockBuilder.build();
}
+ private static Block serializeLongDecimal(
+ BlockBuilder parentBlockBuilder, Object value, Type type, String
columnName) {
+ final BlockBuilder blockBuilder;
+ if (parentBlockBuilder != null) {
+ blockBuilder = parentBlockBuilder;
+ } else {
+ blockBuilder = type.createBlockBuilder(null, 1);
+ }
+ final ByteBuffer buffer = (ByteBuffer) value;
+ type.writeObject(blockBuilder, Int128.fromBigEndian(buffer.array()));
+ if (parentBlockBuilder == null) {
+ return blockBuilder.getSingleValueBlock(0);
+ }
+ return null;
+ }
+
private static void serializePrimitive(BlockBuilder blockBuilder, Object
value, Type type, String columnName) {
requireNonNull(blockBuilder, "parent blockBuilder is null");
diff --git
a/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/decoder/json/PulsarJsonFieldDecoder.java
b/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/decoder/json/PulsarJsonFieldDecoder.java
index c09dd43e241..905e3bd6bec 100644
---
a/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/decoder/json/PulsarJsonFieldDecoder.java
+++
b/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/decoder/json/PulsarJsonFieldDecoder.java
@@ -29,6 +29,7 @@ import static java.lang.String.format;
import static java.util.Objects.requireNonNull;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.DecimalNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.ImmutableList;
import io.airlift.log.Logger;
@@ -45,8 +46,8 @@ import io.trino.spi.type.BigintType;
import io.trino.spi.type.BooleanType;
import io.trino.spi.type.DateType;
import io.trino.spi.type.DecimalType;
-import io.trino.spi.type.Decimals;
import io.trino.spi.type.DoubleType;
+import io.trino.spi.type.Int128;
import io.trino.spi.type.IntegerType;
import io.trino.spi.type.MapType;
import io.trino.spi.type.RealType;
@@ -59,21 +60,22 @@ import io.trino.spi.type.TinyintType;
import io.trino.spi.type.Type;
import io.trino.spi.type.VarbinaryType;
import io.trino.spi.type.VarcharType;
-import java.math.BigInteger;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
/**
- * Copy from {@link io.trino.decoder.json.DefaultJsonFieldDecoder}
(presto-record-decoder-345)
- * with some pulsar's extensions.
+ * Copy from {@link io.trino.decoder.json.DefaultJsonFieldDecoder} with some
pulsar's extensions.
* 1) support {@link io.trino.spi.type.ArrayType}.
* 2) support {@link io.trino.spi.type.MapType}.
* 3) support {@link io.trino.spi.type.RowType}.
- * 4) support {@link io.trino.spi.type.TimestampType},{@link
io.trino.spi.type.DateType},
- * {@link io.trino.spi.type.TimeType}.
+ * 4) support date and time types.
+ * {@link io.trino.spi.type.TimestampType}
+ * {@link io.trino.spi.type.DateType}
+ * {@link io.trino.spi.type.TimeType}
* 5) support {@link io.trino.spi.type.RealType}.
+ * 6) support {@link io.trino.spi.type.DecimalType}.
*/
public class PulsarJsonFieldDecoder
implements JsonFieldDecoder {
@@ -90,7 +92,6 @@ public class PulsarJsonFieldDecoder
Pair<Long, Long> range = getNumRangeByType(columnHandle.getType());
minValue = range.getKey();
maxValue = range.getValue();
-
}
private static Pair<Long, Long> getNumRangeByType(Type type) {
@@ -221,7 +222,7 @@ public class PulsarJsonFieldDecoder
}
// If it is decimalType, need to eliminate the decimal point,
- // and give it to presto to set the decimal point
+ // and give it to trino to set the decimal point
if (type instanceof DecimalType) {
String decimalLong = value.asText().replace(".", "");
return Long.parseLong(decimalLong);
@@ -273,14 +274,6 @@ public class PulsarJsonFieldDecoder
private static Slice getSlice(JsonNode value, Type type, String
columnName) {
String textValue = value.isValueNode() ? value.asText() :
value.toString();
- // If it is decimalType, need to eliminate the decimal point,
- // and give it to presto to set the decimal point
- if (type instanceof DecimalType) {
- textValue = textValue.replace(".", "");
- BigInteger bigInteger = new BigInteger(textValue);
- return Decimals.encodeUnscaledValue(bigInteger);
- }
-
Slice slice = utf8Slice(textValue);
if (type instanceof VarcharType) {
slice = truncateToLength(slice, type);
@@ -298,6 +291,9 @@ public class PulsarJsonFieldDecoder
if (type instanceof RowType) {
return serializeRow(builder, value, type, columnName);
}
+ if (type instanceof DecimalType && !((DecimalType)
type).isShort()) {
+ return serializeLongDecimal(builder, value, type, columnName);
+ }
serializePrimitive(builder, value, type, columnName);
return null;
}
@@ -330,6 +326,27 @@ public class PulsarJsonFieldDecoder
return blockBuilder.build();
}
+ private static Block serializeLongDecimal(
+ BlockBuilder parentBlockBuilder, Object value, Type type,
String columnName) {
+ final BlockBuilder blockBuilder;
+ if (parentBlockBuilder != null) {
+ blockBuilder = parentBlockBuilder;
+ } else {
+ blockBuilder = type.createBlockBuilder(null, 1);
+ }
+
+ assert value instanceof DecimalNode;
+ final DecimalNode node = (DecimalNode) value;
+ // For decimalType, need to eliminate the decimal point,
+ // and give it to trino to set the decimal point
+ type.writeObject(blockBuilder,
Int128.valueOf(node.asText().replace(".", "")));
+
+ if (parentBlockBuilder == null) {
+ return blockBuilder.getSingleValueBlock(0);
+ }
+ return null;
+ }
+
private void serializePrimitive(BlockBuilder blockBuilder, Object
node, Type type, String columnName) {
requireNonNull(blockBuilder, "parent blockBuilder is null");
diff --git
a/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/decoder/json/PulsarJsonRowDecoderFactory.java
b/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/decoder/json/PulsarJsonRowDecoderFactory.java
index 5dd06fa9396..0d5cc2d262d 100644
---
a/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/decoder/json/PulsarJsonRowDecoderFactory.java
+++
b/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/decoder/json/PulsarJsonRowDecoderFactory.java
@@ -116,7 +116,7 @@ public class PulsarJsonRowDecoderFactory implements
PulsarRowDecoderFactory {
}
- private Type parseJsonPrestoType(String fieldname, Schema schema) {
+ private Type parseJsonPrestoType(String fieldName, Schema schema) {
Schema.Type type = schema.getType();
LogicalType logicalType = schema.getLogicalType();
switch (type) {
@@ -126,7 +126,7 @@ public class PulsarJsonRowDecoderFactory implements
PulsarRowDecoderFactory {
case NULL:
throw new UnsupportedOperationException(format(
"field '%s' NULL type code should not be reached , "
- + "please check the schema or report the
bug.", fieldname));
+ + "please check the schema or report the
bug.", fieldName));
case FIXED:
case BYTES:
// When the precision <= 0, throw Exception.
@@ -157,10 +157,10 @@ public class PulsarJsonRowDecoderFactory implements
PulsarRowDecoderFactory {
case BOOLEAN:
return BooleanType.BOOLEAN;
case ARRAY:
- return new ArrayType(parseJsonPrestoType(fieldname,
schema.getElementType()));
+ return new ArrayType(parseJsonPrestoType(fieldName,
schema.getElementType()));
case MAP:
//The key for an avro map must be string.
- TypeSignature valueType = parseJsonPrestoType(fieldname,
schema.getValueType()).getTypeSignature();
+ TypeSignature valueType = parseJsonPrestoType(fieldName,
schema.getValueType()).getTypeSignature();
return typeManager.getParameterizedType(StandardTypes.MAP,
ImmutableList.of(TypeSignatureParameter.
typeParameter(VarcharType.VARCHAR.getTypeSignature()),
TypeSignatureParameter.typeParameter(valueType)));
@@ -173,16 +173,16 @@ public class PulsarJsonRowDecoderFactory implements
PulsarRowDecoderFactory {
} else {
throw new UnsupportedOperationException(format(
"field '%s' of record type has no fields, "
- + "please check schema definition. ",
fieldname));
+ + "please check schema definition. ",
fieldName));
}
case UNION:
for (Schema nestType : schema.getTypes()) {
if (nestType.getType() != Schema.Type.NULL) {
- return parseJsonPrestoType(fieldname, nestType);
+ return parseJsonPrestoType(fieldName, nestType);
}
}
throw new UnsupportedOperationException(format(
- "field '%s' of UNION type must contains not NULL
type.", fieldname));
+ "field '%s' of UNION type must contains not NULL
type.", fieldName));
default:
throw new UnsupportedOperationException(format(
"Can't convert from schema type '%s' (%s) to presto
type.",
diff --git
a/pulsar-sql/presto-pulsar/src/test/java/org/apache/pulsar/sql/presto/decoder/DecoderTestUtil.java
b/pulsar-sql/presto-pulsar/src/test/java/org/apache/pulsar/sql/presto/decoder/DecoderTestUtil.java
index 84d93e78034..60d6028f239 100644
---
a/pulsar-sql/presto-pulsar/src/test/java/org/apache/pulsar/sql/presto/decoder/DecoderTestUtil.java
+++
b/pulsar-sql/presto-pulsar/src/test/java/org/apache/pulsar/sql/presto/decoder/DecoderTestUtil.java
@@ -18,24 +18,23 @@
*/
package org.apache.pulsar.sql.presto.decoder;
+import static io.trino.testing.TestingConnectorSession.SESSION;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
import io.airlift.slice.Slice;
import io.trino.decoder.DecoderColumnHandle;
import io.trino.decoder.FieldValueProvider;
import io.trino.spi.block.Block;
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;
import io.trino.spi.type.Type;
import java.math.BigDecimal;
-import java.math.BigInteger;
import java.util.Map;
-import static
io.trino.spi.type.UnscaledDecimal128Arithmetic.UNSCALED_DECIMAL_128_SLICE_LENGTH;
-import static io.trino.testing.TestingConnectorSession.SESSION;
-import static org.testng.Assert.*;
-
/**
* Abstract util superclass for XXDecoderTestUtil (e.g. AvroDecoderTestUtil
、JsonDecoderTestUtil)
*/
@@ -122,10 +121,10 @@ public abstract class DecoderTestUtil {
FieldValueProvider provider = decodedRow.get(handle);
DecimalType decimalType = (DecimalType) handle.getType();
BigDecimal actualDecimal;
- if (decimalType.getFixedSize() == UNSCALED_DECIMAL_128_SLICE_LENGTH) {
- Slice slice = provider.getSlice();
- BigInteger bigInteger = Decimals.decodeUnscaledValue(slice);
- actualDecimal = new BigDecimal(bigInteger, decimalType.getScale());
+ if (decimalType.getFixedSize() == Int128.SIZE) {
+ final Block block = provider.getBlock();
+ final Int128 actualValue = (Int128) decimalType.getObject(block,
0);
+ actualDecimal = new BigDecimal(actualValue.toBigInteger(),
decimalType.getScale());
} else {
actualDecimal = BigDecimal.valueOf(provider.getLong(),
decimalType.getScale());
}
diff --git
a/pulsar-sql/presto-pulsar/src/test/java/org/apache/pulsar/sql/presto/decoder/avro/TestAvroDecoder.java
b/pulsar-sql/presto-pulsar/src/test/java/org/apache/pulsar/sql/presto/decoder/avro/TestAvroDecoder.java
index 79ca0f5a650..c4e7009b946 100644
---
a/pulsar-sql/presto-pulsar/src/test/java/org/apache/pulsar/sql/presto/decoder/avro/TestAvroDecoder.java
+++
b/pulsar-sql/presto-pulsar/src/test/java/org/apache/pulsar/sql/presto/decoder/avro/TestAvroDecoder.java
@@ -18,6 +18,19 @@
*/
package org.apache.pulsar.sql.presto.decoder.avro;
+import static io.trino.spi.type.BigintType.BIGINT;
+import static io.trino.spi.type.BooleanType.BOOLEAN;
+import static io.trino.spi.type.DoubleType.DOUBLE;
+import static io.trino.spi.type.IntegerType.INTEGER;
+import static io.trino.spi.type.RealType.REAL;
+import static io.trino.spi.type.TimeType.TIME_MILLIS;
+import static io.trino.spi.type.TimestampType.TIMESTAMP_MILLIS;
+import static io.trino.spi.type.VarcharType.VARCHAR;
+import static java.lang.Float.floatToIntBits;
+import static
org.apache.pulsar.sql.presto.TestPulsarConnector.getPulsarConnectorId;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.expectThrows;
import com.google.common.collect.ImmutableList;
import io.netty.buffer.ByteBuf;
import io.trino.decoder.DecoderColumnHandle;
@@ -33,6 +46,10 @@ import io.trino.spi.type.Type;
import io.trino.spi.type.TypeSignatureParameter;
import io.trino.spi.type.VarcharType;
import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.time.ZoneId;
+import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
@@ -47,25 +64,6 @@ import
org.apache.pulsar.sql.presto.decoder.DecoderTestMessage;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import java.time.LocalDate;
-import java.time.LocalTime;
-import java.time.ZoneId;
-import java.time.temporal.ChronoUnit;
-
-import static io.trino.spi.type.BigintType.BIGINT;
-import static io.trino.spi.type.BooleanType.BOOLEAN;
-import static io.trino.spi.type.DoubleType.DOUBLE;
-import static io.trino.spi.type.IntegerType.INTEGER;
-import static io.trino.spi.type.RealType.REAL;
-import static io.trino.spi.type.TimeType.TIME_MILLIS;
-import static io.trino.spi.type.TimestampType.TIMESTAMP_MILLIS;
-import static io.trino.spi.type.VarcharType.VARCHAR;
-import static java.lang.Float.floatToIntBits;
-import static
org.apache.pulsar.sql.presto.TestPulsarConnector.getPulsarConnectorId;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.expectThrows;
-
public class TestAvroDecoder extends AbstractDecoderTester {
private AvroSchema schema;