Skip to content

Commit 935c8c0

Browse files
voonhouscodope
authored andcommitted
Fix SqlDate type not able to cast to Number error
1 parent 01167b3 commit 935c8c0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: plugin/trino-hudi/src/main/java/io/trino/plugin/hudi/util/HudiAvroSerializer.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import io.trino.spi.type.LongTimestamp;
3030
import io.trino.spi.type.LongTimestampWithTimeZone;
3131
import io.trino.spi.type.RowType;
32+
import io.trino.spi.type.SqlDate;
3233
import io.trino.spi.type.Type;
3334
import io.trino.spi.type.VarbinaryType;
3435
import io.trino.spi.type.VarcharType;
@@ -162,7 +163,7 @@ else if (type instanceof DecimalType decimalType) {
162163
type.writeLong(output, encodeShortScaledValue(decimal, decimalType.getScale()));
163164
}
164165
else if (type.equals(DATE)) {
165-
type.writeLong(output, ((Number) value).intValue());
166+
type.writeLong(output, ((SqlDate) value).getDays());
166167
}
167168
else if (type.equals(TIMESTAMP_MICROS)) {
168169
type.writeLong(output, toTrinoTimestamp(((Utf8) value).toString()));

0 commit comments

Comments
 (0)