[ 
https://issues.apache.org/jira/browse/FLINK-40934?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ramin Gharib closed FLINK-40934.
--------------------------------
    Release Note: The current behavior is okay
      Resolution: Won't Do

>  Table API row() fails when AS aliases produce duplicate field names
> --------------------------------------------------------------------
>
>                 Key: FLINK-40934
>                 URL: https://issues.apache.org/jira/browse/FLINK-40934
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>    Affects Versions: 2.4.0
>            Reporter: Ramin Gharib
>            Priority: Major
>
> FLINK-39253 names the fields of the Table API \{{row()}} function after the 
> \{{AS}} aliases of its arguments. An argument without an alias still gets 
> \{{f<index>}}. The names are not de-duplicated, so the call fails when two of 
> them collide:
> {code:java}
> row($("a").as("f1"), $("b"))         // f1, f1
> row($("a").as("x"), $("b").as("x"))  // x, x
> row($("a"), $("b").as("f0"))         // f0, f0
> {code}
> Each fails during resolution with:
> {noformat}
> org.apache.flink.table.api.ValidationException: Invalid function call:
> ...
> Caused by: org.apache.flink.table.api.ValidationException: Field names must 
> be unique. Found duplicates: [f1]
> {noformat}
> Before FLINK-39253, all three calls resolved and named the fields f0 and f1. 
> FLINK-39253 is only on master, so the regression would first ship in 2.4.0. 
> SQL \{{ROW(...)}} is not affected.
> Suggested fix: when the resolved names are not unique, fall back to 
> \{{f<index>}} for every field. That keeps every call that resolved before 
> FLINK-39253 working. A narrower option is to fall back only for the clashing 
> field, but then a field's name depends on its neighbours.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to