You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Noémi Pap-Takács (Jira)" <ji...@apache.org> on 2026/10/19 13:14:01 UTC

[jira] [Updated] (IMPALA-14482) Calcite planner: ordering by "random()" fails

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

Noémi Pap-Takács updated IMPALA-14482:
--------------------------------------
    Fix Version/s: Impala 5.0.0

> Calcite planner: ordering by "random()" fails
> ---------------------------------------------
>
>                 Key: IMPALA-14482
>                 URL: https://issues.apache.org/jira/browse/IMPALA-14482
>             Project: IMPALA
>          Issue Type: Sub-task
>            Reporter: Steve Carlin
>            Assignee: Steve Carlin
>            Priority: Major
>             Fix For: Impala 5.0.0
>
>
> The "select random() order by 1" query is not ordering the results.
> The reason is because of the SortRemoveConstantKeys rule in Calcite.  This rule will remove the "order by" clause if it thinks there key is constant.  It currently does this for all literals (e.g. "select '1' from tbl order by 1") which is correct, but it also does it for functions with no input expressions.  So it treats "random()" as a constant expression.
> We need to create our own SortRemoveConstantKeys rule that takes this into account.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org