You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Yuval Itzchakov <yu...@gmail.com> on 2021/10/28 20:15:10 UTC

Converting a Table to a DataStream[RowData] instead of DataStream[Row] with `toDataStream`

Flink 1.14
Scala 2.12.5

Hi,
I want to be able to convert a Table into a DataStream[RowData]. I need to
do this since I already have specific infrastructure in place that knows
how to serialize RowData into a JSON format. Previously when using
toAppendStream[RowData], this worked fine.

However, now with the new toDataStream API, I don't see a direct way to do
this. Using toDataStream[RowData](tableSchema.toPhysicalRowDataType) still
creates an internal OutputConversionOperator and yields a Row to the Kafka
sink I'm trying to use.

Would love some help.

-- 
Best Regards,
Yuval Itzchakov.

Re: Converting a Table to a DataStream[RowData] instead of DataStream[Row] with `toDataStream`

Posted by Yuval Itzchakov <yu...@gmail.com>.
It works!

Thank you Nicolaus.

On Tue, Nov 2, 2021 at 12:40 PM Nicolaus Weidner <
nicolaus.weidner@ververica.com> wrote:

> Hi Yuval,
>
> Can you try
> toDataStream[RowData](tableSchema.toPhysicalRowDataType.bridgedTo(classOf[RowData]))?
>
> Best regards,
> Nico
>
> On Thu, Oct 28, 2021 at 10:15 PM Yuval Itzchakov <yu...@gmail.com>
> wrote:
>
>> Flink 1.14
>> Scala 2.12.5
>>
>> Hi,
>> I want to be able to convert a Table into a DataStream[RowData]. I need
>> to do this since I already have specific infrastructure in place that knows
>> how to serialize RowData into a JSON format. Previously when using
>> toAppendStream[RowData], this worked fine.
>>
>> However, now with the new toDataStream API, I don't see a direct way to
>> do this. Using toDataStream[RowData](tableSchema.toPhysicalRowDataType)
>> still creates an internal OutputConversionOperator and yields a Row to the
>> Kafka sink I'm trying to use.
>>
>> Would love some help.
>>
>> --
>> Best Regards,
>> Yuval Itzchakov.
>>
>

-- 
Best Regards,
Yuval Itzchakov.

Re: Converting a Table to a DataStream[RowData] instead of DataStream[Row] with `toDataStream`

Posted by Nicolaus Weidner <ni...@ververica.com>.
Hi Yuval,

Can you try
toDataStream[RowData](tableSchema.toPhysicalRowDataType.bridgedTo(classOf[RowData]))?

Best regards,
Nico

On Thu, Oct 28, 2021 at 10:15 PM Yuval Itzchakov <yu...@gmail.com> wrote:

> Flink 1.14
> Scala 2.12.5
>
> Hi,
> I want to be able to convert a Table into a DataStream[RowData]. I need to
> do this since I already have specific infrastructure in place that knows
> how to serialize RowData into a JSON format. Previously when using
> toAppendStream[RowData], this worked fine.
>
> However, now with the new toDataStream API, I don't see a direct way to do
> this. Using toDataStream[RowData](tableSchema.toPhysicalRowDataType) still
> creates an internal OutputConversionOperator and yields a Row to the Kafka
> sink I'm trying to use.
>
> Would love some help.
>
> --
> Best Regards,
> Yuval Itzchakov.
>