Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query: support order by on expr alias #258

Closed
pleiadesian opened this issue Dec 22, 2021 · 0 comments · Fixed by #282
Closed

query: support order by on expr alias #258

pleiadesian opened this issue Dec 22, 2021 · 0 comments · Fixed by #282
Assignees

Comments

@pleiadesian
Copy link
Contributor

When executing TPC-H Q3, a bind error occurs. To fix it, we should support order by on the alias of an expression in select clause.

> SELECT
  L_ORDERKEY,
  SUM(L_EXTENDEDPRICE * (1 - L_DISCOUNT)) AS REVENUE,
  O_ORDERDATE,
  O_SHIPPRIORITY
FROM
  CUSTOMER,
  ORDERS,
  LINEITEM
WHERE
  C_MKTSEGMENT = 'BUILDING'
  AND C_CUSTKEY = O_CUSTKEY
  AND L_ORDERKEY = O_ORDERKEY
  AND O_ORDERDATE < '1995-03-15'
  AND L_SHIPDATE > '1995-03-15'
GROUP BY
  L_ORDERKEY,
  O_ORDERDATE,
  O_SHIPPRIORITY
ORDER BY
  REVENUE DESC,
  O_ORDERDATE,
  L_ORDERKEY
LIMIT 10

bind error: invalid column REVENUE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant