In https://ci.apache.org/projects/flink/flink-docs-release-1.8/dev/table/common.html#convert-a-table-into-a-datastream-or-dataset,
POJO data type is available to convert to DataStream. I would like to use POJO data type class with private fields. I wonder it is possible or not officially. Any currently it does not work. Codes: ————— CsvTableSource as = CsvTableSource.builder() ————— public class P implements Serializable { ————— Above codes, I got below error message: ========== Exception in thread "main" org.apache.flink.table.api.TableException: Arity [2] of result [ArrayBuffer(String, Integer)] does not match the number[1] of requested type [GenericType<aa.P>]. at org.apache.flink.table.api.TableEnvironment.generateRowConverterFunction(TableEnvironment.scala:1165) at org.apache.flink.table.api.StreamTableEnvironment.getConversionMapper(StreamTableEnvironment.scala:423) at org.apache.flink.table.api.StreamTableEnvironment.translate(StreamTableEnvironment.scala:936) at org.apache.flink.table.api.StreamTableEnvironment.translate(StreamTableEnvironment.scala:866) at org.apache.flink.table.api.java.StreamTableEnvironment.toAppendStream(StreamTableEnvironment.scala:202) at org.apache.flink.table.api.java.StreamTableEnvironment.toAppendStream(StreamTableEnvironment.scala:156) at ... ========== When fields of class P are changed to “public”, it works well. ————— public class P implements Serializable { ————— Thanks, skonmeme |
Hi Sung,
private fields are only supported if
you specify getters and setters accordingly. Otherwise you need to
use `Row.class` and perform the mapping in a subsequent map()
function manually via reflection.
Regards,
Timo Am 29.04.19 um 15:44 schrieb Sung Gon
Yi:
In https://ci.apache.org/projects/flink/flink-docs-release-1.8/dev/table/common.html#convert-a-table-into-a-datastream-or-dataset,
|
|
In reply to this post by Timo Walther
Sorry. I sent an empty reply.
I tried again with getter/setter. And it works. Thanks. ————— import lombok.Getter; —————
|
Free forum by Nabble | Edit this page |