[
https://issues.apache.org/jira/browse/FLINK-26770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Timo Walther closed FLINK-26770.
--------------------------------
Fix Version/s: 1.15.0
Resolution: Fixed
Fixed in master: 7f3fa549638cb2e7b9ddf53366bf744f1f5c6568
Fixed in 1.15: d1445f115473efd389a2eadd8ec756cbcdfbde47
> Nullable ArrayData should not be Object[]
> -----------------------------------------
>
> Key: FLINK-26770
> URL: https://issues.apache.org/jira/browse/FLINK-26770
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner, Table SQL / Runtime
> Affects Versions: 1.15.0
> Reporter: Wenlong Lyu
> Assignee: Francesco Guardiani
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.15.0
>
>
> 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]
>
> 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 specific
> types, like Integer[], I think we should follow
> CodeGenUtils#boxedTypeTermForType
> [~slinkydeveloper]
--
This message was sent by Atlassian Jira
(v8.20.1#820001)