yanjing.wang created CALCITE-4987:
-------------------------------------
Summary: JDBC adapter generates incorrect query when order by
alias collides with field in select item
Key: CALCITE-4987
URL: https://issues.apache.org/jira/browse/CALCITE-4987
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.29.0
Environment: jdk8
Reporter: yanjing.wang
Assignee: yanjing.wang
Fix For: 1.30.0
I reproduce with the following query.
{code:java}
SELECT sum(shelf_width) as shelf_width FROM product ORDER BY shelf_width{code}
you must have noticed that the shelf_width alias is same with field
'shelf_width' in sum.
I expected the query hasn't changed when I test in RelToSqlConverterTest. But I
get unexpected query is
{code:java}
SELECT sum(shelf_width) as shelf_width FROM product ORDER BY sum(shelf_width)
{code}
the unexpected query is not valid in the dialect which support order by alias
conformance.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)