Dawid Wysakowicz created FLINK-36639:
----------------------------------------

             Summary: Use table aliases in Table API asSerializableString
                 Key: FLINK-36639
                 URL: https://issues.apache.org/jira/browse/FLINK-36639
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / API
            Reporter: Dawid Wysakowicz
            Assignee: Dawid Wysakowicz
             Fix For: 2.0.0


Certain operations do not work without explicitly scoping a fieldreference. For 
example:

```
SELECT `composite_column`.`f0_nested` FROM (
      SELECT 
         (CAST(ROW(`f0`, 'a') AS ROW<`f0_nested` BIGINT, `f1_nested` 
VARCHAR(2147483647)>)) AS `composite_column` 
      FROM `data`
  )
```

fails with:

```
SELECT `composite_column`.`f0_nested` FROM (
      SELECT 
         (CAST(ROW(`f0`, 'a') AS ROW<`f0_nested` BIGINT, `f1_nested` 
VARCHAR(2147483647)>)) AS `composite_column` 
      FROM `data`
  )
```

but a query like:
```
SELECT `t`.`composite_column`.`f0_nested` FROM (
      SELECT 
         (CAST(ROW(`f0`, 'a') AS ROW<`f0_nested` BIGINT, `f1_nested` 
VARCHAR(2147483647)>)) AS `composite_column` 
      FROM `data`
  ) t
```

works just fine. Unfortunately, this can not be achieved in Table API manually. 
Therefore the proposal is to scope all columns in all 
`QueryOperation#asSerializableString`.



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

Reply via email to