ash-project / ash

A declarative, extensible framework for building Elixir applications.
https://www.ash-hq.org
MIT License
1.63k stars 216 forks source link

Ash.Query.distinct not working when using Ash.count #1472

Open Torkan opened 1 month ago

Torkan commented 1 month ago

Describe the bug Ash.Query.distinct does not affect the query when using Ash.count. Using Ash.read however works as expected.

To Reproduce

SomeResource
|> Ash.Query.distinct([:some_field])
|> Ash.count!(opts)

compare with

SomeResource
|> Ash.Query.distinct([:some_field])
|> Ash.read!(opts)

Expected behavior That the resulting query includes the distinct select-statement

Runtime