Re: Cannot map nested Tuple fields to table columns

2020-04-27 Thread Dawid Wysakowicz
What I meant by "Unfortunately you can not reorder the fields that way." is that    tableEnv.fromDataStream(input, “name, age, height"); uses the so-called referenceByPosition mode. It will name the f0 field -> name, the f1 -> age and f2 -> height. If it wasn't for the bug you could reorder and

Re: Cannot map nested Tuple fields to table columns

2020-04-27 Thread Gyula Fóra
Hi Dawid, Thanks for the clarification on this issue and I agree that there is too much going on with these conversions already. What do you mean by "Unfortunately you can not reorder the fields that way." ? I can reorder POJO fields even after aliasing and also tuple fields (f1, f0) so I assume

Re: Cannot map nested Tuple fields to table columns

2020-04-27 Thread Dawid Wysakowicz
Hi Gyula, I think you are hitting a bug with the naming/aliasing of the fields of a Tuple. The bug is in the org.apache.flink.table.typeutils.FieldInfoUtils#isReferenceByPosition method. As it does not work correctly for aliases. Would you mind creating an issue for it? You should be able to alia

Re: Cannot map nested Tuple fields to table columns

2020-04-27 Thread Gyula Fóra
Hi Leonard, The tuple fields can also be referenced as their POJO names (f0, f1), they can be reordered similar to pojo fields, however you cannot alias them. (If you look at the link I have sent that shows how it is supposed to work but it throws an exception when I try it) Also what I am trying

Re: Cannot map nested Tuple fields to table columns

2020-04-27 Thread Leonard Xu
Hi, gyula.fora If you’re trying convert Table from a Tuple DataStream, Alias the filed by `as` expression is no supported yet, because all fields are referenced by position in this point. You can simply alias like following syntax: ``` tableEnv.fromDataStream(env.fromElements(Tuple2.of("a", 1))

Cannot map nested Tuple fields to table columns

2020-04-27 Thread Gyula Fóra
Hi All! I was trying to flatten a nested tuple into named columns with the fromDataStream method and I hit some problems with mapping tuple fields to column names. It seems like the `f0 as ColumnName` kind of expressions are not parsed correctly. It is very easy to reproduce: tableEnv.fromDataSt