Skip to content

The Group by, Order by scenarios have issues with reference field aliases #10140

@DockerLive

Description

@DockerLive

Affected Version

Druid version : 0.18.0

Description

  • Druid SQL queries using the Avatica JDBC driver.
  • The Order BY field must use the field alias
  • The Group by field must not use field aliases
  • Otherwise the SQL will parse the exception
  • The same SQL that I use to execute queries through the UI that druid comes with is normal
  • Replace the Order BY field with an alias;The Group by field is replaced with the field name, and the SQL executes normally

The scenario is as follows:
SQL:
select
TIME_FORMAT(FLOOR(_time to day), 'yyyyMMdd') as time ,
cast(sum(cnt) as VARCHAR) as measureValue
from tab_test
where __time >= '2019-05-31' and __time < '2020-08-28'
and biz_date between '20200601' and '20200627'
and project = 'com'
and event_key = 'app_boot_cold'
group by
TIME_FORMAT(FLOOR(__time to day), 'yyyyMMdd')
order by
TIME_FORMAT(FLOOR(__time to day), 'yyyyMMdd')

Exception:
org.apache.calcite.runtime.CalciteContextException: From line 21, column 35 to line 21, column 40: Column '__time' not found in any table

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions