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

Dawid Wysakowicz updated FLINK-36639:
-------------------------------------
    Description: 
Certain operations do not work without explicitly scoping a fieldreference. For 
example:

{code}
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`
  )
{code}

fails with:

{code}
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`
  )
{code}

but a query like:
{code}
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
{code}

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}}.

  was:
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`.


> 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
>            Priority: Major
>             Fix For: 2.0.0
>
>
> Certain operations do not work without explicitly scoping a fieldreference. 
> For example:
> {code}
> 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`
>   )
> {code}
> fails with:
> {code}
> 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`
>   )
> {code}
> but a query like:
> {code}
> 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
> {code}
> 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