[
https://issues.apache.org/jira/browse/FLINK-36284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
xuyang updated FLINK-36284:
---------------------------
Priority: Blocker (was: Minor)
> StreamTableEnvironment#toDataStream(Table table, Class<T> targetClass) is not
> suitable for setting targetClass as a class generated by Avro.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: FLINK-36284
> URL: https://issues.apache.org/jira/browse/FLINK-36284
> Project: Flink
> Issue Type: Improvement
> Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile), Table
> SQL / API
> Reporter: xuyang
> Priority: Blocker
> Fix For: 2.0-preview
>
> Attachments: image-2024-09-14-17-39-16-698.png
>
>
> This issue can be fired by updating the {{testAvroToAvro}} method in the
> {{org.apache.flink.table.runtime.batch.AvroTypesITCase}} class.
>
> {code:java}
> @Test
> public void testAvroToAvro() {
> StreamExecutionEnvironment env =
> StreamExecutionEnvironment.getExecutionEnvironment();
> StreamTableEnvironment tEnv = StreamTableEnvironment.create(env);
> DataStream<User> ds = testData(env);
> // before: using deprecated method
> // Table t = tEnv.fromDataStream(ds, selectFields(ds));
> // after: using recommended new method
> Table t = tEnv.fromDataStream(ds);
> Table result = t.select($("*"));
> // before: using deprecated method
> // List<User> results =
> // CollectionUtil.iteratorToList(
> // DataStreamUtils.collect(tEnv.toAppendStream(result,
> User.class)));
> // after: using recommended new method
> List<User> results =
> CollectionUtil.iteratorToList(
> DataStreamUtils.collect(tEnv.toDataStream(result,
> User.class)));
> List<User> expected = Arrays.asList(USER_1, USER_2, USER_3);
> assertThat(results).isEqualTo(expected);
> } {code}
> An exception will be thrown:
> !image-2024-09-14-17-39-16-698.png|width=1049,height=594!
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)