[ 
https://issues.apache.org/jira/browse/FLINK-31835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17715474#comment-17715474
 ] 

Aitozi commented on FLINK-31835:
--------------------------------

The first thought in my mind is that the conversion class for atomic type eg: 
{{IntType}} should respect to the nullability. So, when a {{IntType}} copy from 
nullable to not null. Its default conversionClass will change from {{Integer}} 
to {{int}}.

And in the DataType: {{AtomicType}} and {{CollectionDataType}} should also 
respect to the nullable and notNull call. The conversionClass of the dataType 
should be changed after these call.

I have verified this locally, it can solve this problem, what do you think this 
solution [~jark] ?

> DataTypeHint don't support Row<i Array<int>>
> --------------------------------------------
>
>                 Key: FLINK-31835
>                 URL: https://issues.apache.org/jira/browse/FLINK-31835
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>    Affects Versions: 1.15.4
>            Reporter: jeff-zou
>            Priority: Major
>
> Using DataTypeHint("Row<t ARRAY<INT>>") in a UDF gives the following error:
>  
> {code:java}
> Caused by: java.lang.ClassCastException: class [I cannot be cast to class 
> [Ljava.lang.Object; ([I and [Ljava.lang.Object; are in module java.base of 
> loader 'bootstrap')
> org.apache.flink.table.data.conversion.ArrayObjectArrayConverter.toInternal(ArrayObjectArrayConverter.java:40)
> org.apache.flink.table.data.conversion.DataStructureConverter.toInternalOrNull(DataStructureConverter.java:61)
> org.apache.flink.table.data.conversion.RowRowConverter.toInternal(RowRowConverter.java:75)
> org.apache.flink.table.data.conversion.RowRowConverter.toInternal(RowRowConverter.java:37)
> org.apache.flink.table.data.conversion.DataStructureConverter.toInternalOrNull(DataStructureConverter.java:61)
> StreamExecCalc$251.processElement_split9(Unknown Source)
> StreamExecCalc$251.processElement(Unknown Source)
> org.apache.flink.streaming.runtime.tasks.CopyingChainingOutput.pushToOperator(CopyingChainingOutput.java:82)
>  {code}
>  
> The function is as follows:
> {code:java}
> @DataTypeHint("Row<t ARRAY<INT>>")
> public Row eval() {
> int[] i = new int[3];
> return Row.of(i);
> } {code}
>  
> This error is not reported when testing other simple types, so it is not an 
> environmental problem.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to