Re: Reverse the order of fields in Flink SQL

2018-10-23 Thread yinhua.dai
Hi Timo, I write simple testing code for the issue, please checkout https://gist.github.com/yinhua-dai/143304464270afd19b6a926531f9acb1 I write a custom table source which just use RowCsvInputformat to create the dataset, and use the provided CsvTableSink, and can reproduce the issue. -- Sent

Re: Reverse the order of fields in Flink SQL

2018-10-23 Thread yinhua.dai
I think I have already done that in my custom sink. @Override public String[] getFieldNames() { return this.fieldNames; } @Override public TypeInformation[] getFieldTypes() { return this.fieldTypes; } @Override public TableSink configure(String[] fieldNames, TypeInformation

Re: Reverse the order of fields in Flink SQL

2018-10-23 Thread Timo Walther
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;

Reverse the order of fields in Flink SQL

2018-10-23 Thread 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 CsvTableSou