Skip to content

[CALCITE-6519] Non-aggregate query that uses measure in ORDER BY#3907

Closed
julianhyde wants to merge 1 commit intoapache:mainfrom
julianhyde:6519-measure-order
Closed

[CALCITE-6519] Non-aggregate query that uses measure in ORDER BY#3907
julianhyde wants to merge 1 commit intoapache:mainfrom
julianhyde:6519-measure-order

Conversation

@julianhyde
Copy link
Copy Markdown
Contributor

As of [CALCITE-4496], a non-aggregate query can use measures in its SELECT clause; this change further allows a non-aggregate query to use measures in its ORDER BY clause. Example:

  WITH empm AS
    (SELECT *, avg(sal) AS MEASURE avgSal FROM emp)
  SELECT avgSal, deptno
  FROM empm
  ORDER BY avgSal DESC LIMIT 3;

As of [CALCITE-4496], a non-aggregate query can use measures
in its SELECT clause; this change further allows a
non-aggregate query to use measures in its ORDER BY clause.
Example:

  WITH empm AS
    (SELECT *, avg(sal) AS MEASURE avgSal FROM emp)
  SELECT avgSal, deptno
  FROM empm
  ORDER BY avgSal DESC LIMIT 3;
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Aug 7, 2024

julianhyde added a commit to julianhyde/calcite that referenced this pull request Aug 8, 2024
As of [CALCITE-4496], a non-aggregate query can use measures
in its SELECT clause; this change further allows a
non-aggregate query to use measures in its ORDER BY clause.
Example:

  WITH empm AS
    (SELECT *, avg(sal) AS MEASURE avgSal FROM emp)
  SELECT avgSal, deptno
  FROM empm
  ORDER BY avgSal DESC LIMIT 3;

Close apache#3907

/** Tests use of a measure in a non-aggregate query. Calls
* {@link RelOptFixture#checkUnchanged()} because Sql-to-rel has done the
* necessary work already. */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to add jira link?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because this query has no ORDER BY such queries were working before this change.

@julianhyde julianhyde closed this in 27fd583 Aug 8, 2024
olivrlee pushed a commit to olivrlee/calcite that referenced this pull request Sep 26, 2024
As of [CALCITE-4496], a non-aggregate query can use measures
in its SELECT clause; this change further allows a
non-aggregate query to use measures in its ORDER BY clause.
Example:

  WITH empm AS
    (SELECT *, avg(sal) AS MEASURE avgSal FROM emp)
  SELECT avgSal, deptno
  FROM empm
  ORDER BY avgSal DESC LIMIT 3;

Close apache#3907
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 this pull request may close these issues.

3 participants