Wenlong Lyu created FLINK-26770:
-----------------------------------
Summary: Nullable ArrayData should not be Object[]
Key: FLINK-26770
URL: https://issues.apache.org/jira/browse/FLINK-26770
Project: Flink
Issue Type: Bug
Affects Versions: 1.15.0
Reporter: Wenlong Lyu
sql:
"INSERT INTO %s "
+ " (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) values ("
+ "1,'dim',cast(20.2007 as
double),false,652482,cast('2020-07-08' as date),'source_test',cast('2020-07-10
16:28:07.737' as timestamp),"
+ "cast(8.58965 as float),cast(ARRAY [464,98661,32489] as
array<int>),cast(ARRAY [8589934592,8589934593,8589934594] as array<bigint>),"
+ "ARRAY[cast(8.58967 as float),cast(96.4667 as
float),cast(9345.16 as float)], ARRAY [cast(587897.4646746 as
double),cast(792343.646446 as double),cast(76.46464 as double)],"
+ "cast(ARRAY [true,true,false,true] as
array<boolean>),cast(ARRAY ['monday','saturday','sunday'] as
array<STRING>),true,cast(8119.21 as numeric(6,2)), cast('2020-07-10
16:28:07.737' as timestamp)"
+ ")";
error:
Caused by: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
[Ljava.lang.Integer;
at
org.apache.flink.table.data.GenericArrayData.toIntArray(GenericArrayData.java:297)
~[flink-table-common-1.15-vvr-6.0-SNAPSHOT.jar:1.15-vvr-6.0-SNAPSHOT]
related codegen result:
objArray$81 = new Object[result$76.size()];
for ( i$82 = 0; i$82 < result$76.size(); i$82++) {
if (!result$76.isNullAt(i$82)) {
objArray$81[i$82] = result$76.getBoolean(i$82);
cause:
ArrayToArrayCastRule#arrayElementType use Object when a column is
nullable, but GenericArrayData only accepts array with specified types, like
Integer[], I think we should follow CodeGenUtils#boxedTypeTermForType
[~slinkydeveloper]
--
This message was sent by Atlassian Jira
(v8.20.1#820001)