You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jark Wu (Jira)" <ji...@apache.org> on 2023/04/23 04:03:00 UTC

[jira] [Commented] (FLINK-31835) DataTypeHint don't support Row>

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

Jark Wu commented on FLINK-31835:
---------------------------------

Hi [~jeff-zou], thanks for reporting this. I think this is expected. You should declare the type hint as "ARRAY<INT NOT NULL>" to map to {{int[]}}. "ARRAY<INT>" is recognized as a result of {{Integer[]}}. That's why the conversion class is {{ArrayObjectArrayConverter}}. 

But I think the exception message can be improved. 

> 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)