[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reverse the order of fields in Flink SQL

Hi Yinhua,

your custom sink must implement `org.apache.flink.table.sinks.TableSink#configure`. This method is called when writing to a sink such that the sink can configure itself for the reverse order. The methods `getFieldTypes` and `getFieldNames` must then return the reconfigured schema; must match to the query result schema.


Am 23.10.18 um 09:47 schrieb yinhua.dai:
I write a customized table source, and it emits some fields let's say f1, f2.

And then I just write to a sink with a reversed order of fields, as below:
*select f2, f1 from customTableSource*

And I found that it actually doesn't do the field reverse.

Then I tried with flink provided CsvTableSource and CsvTableSink, I found
that it has no problem reverse the order, and after some investigation I
found that it's related with two things:
1. *CsvTableSource* implemented *ProjectableTableSource*
2. *RowCsvInputFormat* supports *selectedFields*

Do I have to do the two things as well in my custom table source to get the
reverse work?

Sent from: