flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Flink Jira Bot (Jira)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-12701) Column name alias causes exception when used with where and group-by
Date Thu, 22 Apr 2021 11:50:02 GMT

    [ https://issues.apache.org/jira/browse/FLINK-12701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17328408#comment-17328408
] 

Flink Jira Bot commented on FLINK-12701:
----------------------------------------

This major issue is unassigned and itself and all of its Sub-Tasks have not been updated for
30 days. So, it has been labeled "stale-major". If this ticket is indeed "major", please either
assign yourself or give an update. Afterwards, please remove the label. In 7 days the issue
will be deprioritized.

> Column name alias causes exception when used with where and group-by
> --------------------------------------------------------------------
>
>                 Key: FLINK-12701
>                 URL: https://issues.apache.org/jira/browse/FLINK-12701
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.8.0
>            Reporter: Josh Bradt
>            Priority: Major
>              Labels: stale-major
>
> Assigning a column an alias containing a space sometimes causes an exception even though
the docs suggest this is valid.
> Assume we have a table {{Groups}} that contains a string-typed column called {{name}}.
Then the query
> {code:sql}
> SELECT `Groups`.`name` AS `Group Name` FROM `Groups`
> {code}
> works as expected, but
> {code:sql}
> SELECT `Groups`.`name` AS `Group Name` 
> FROM `Groups` 
> WHERE `Groups`.`name` LIKE 'Treat%' 
> ORDER BY `Groups`.`name` ASC
> {code}
> produces the following exception
> {code:java}
> org.apache.flink.api.common.typeutils.CompositeType$InvalidFieldReferenceException: Invalid
tuple field reference "Group Name".
> 	at org.apache.flink.api.java.typeutils.RowTypeInfo.getFlatFields(RowTypeInfo.java:97)
> 	at org.apache.flink.api.common.operators.Keys$ExpressionKeys.<init>(Keys.java:266)
> 	at org.apache.flink.api.common.operators.Keys$ExpressionKeys.<init>(Keys.java:223)
> 	at org.apache.flink.api.java.DataSet.partitionByRange(DataSet.java:1298)
> 	at org.apache.flink.table.plan.nodes.dataset.DataSetSort.translateToPlan(DataSetSort.scala:99)
> 	at org.apache.flink.table.api.BatchTableEnvironment.translate(BatchTableEnvironment.scala:498)
> 	at org.apache.flink.table.api.BatchTableEnvironment.translate(BatchTableEnvironment.scala:476)
> 	at org.apache.flink.table.api.BatchTableEnvironment.writeToSink(BatchTableEnvironment.scala:311)
> 	at org.apache.flink.table.api.TableEnvironment.insertInto(TableEnvironment.scala:879)
> 	at org.apache.flink.table.api.Table.insertInto(table.scala:1126)
> 	[...]
> {code}
> If you remove the {{WHERE}} clause or the {{ORDER BY}} clause, it works fine. It only
fails when both are included. Additionally, it works fine if the column alias ({{AS `Group
Name`}}) is removed or if it doesn't contain a space ({{AS `GroupName`}}).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message