Skip to content

Conversation

rellen
Copy link
Contributor

@rellen rellen commented Sep 15, 2025

This replicates an issue seen.

We have an expression calculation using a aggregation from a transitive relationship. If that calculation is used in a sort, the text of the expression is passed as the aggregate name, instead of a varaible name such as "aggregate0" etc.

E.g.

* ** (RuntimeError) Unbound aggregate field: "first(comments[field: :created_at, query: [filter: author_id ==\"54c6b3da-d3a5-41f6-8409-780fed9fe184\"]])"

Contributor checklist

Leave anything that you believe does not apply unchecked.

  • I accept the AI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

@rellen rellen force-pushed the tests/calculation-with-aggregate-expr branch from f99d6fd to 67b9c63 Compare September 15, 2025 06:31
This replicates an issue seen.

We have an expression calculation using a aggregation from a transitive
relationship.  If that calculation is used in a sort, the text of the
expression is passed as the aggregate name, instead of a variable name
such as "aggregate0" etc.

E.g.
```
* ** (RuntimeError) Unbound aggregate field:
"first(comments[field: :created_at, query: [filter: author_id ==
\"54c6b3da-d3a5-41f6-8409-780fed9fe184\"]])"
```
@rellen rellen force-pushed the tests/calculation-with-aggregate-expr branch from 67b9c63 to 3343f61 Compare September 15, 2025 06:50
@rellen
Copy link
Contributor Author

rellen commented Sep 17, 2025

Reproduction for ash-project/ash_sql#173

@zachdaniel zachdaniel merged commit 58c9543 into ash-project:main Sep 18, 2025
61 of 64 checks passed
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.

2 participants