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

distinct produces an erroneous error message #69

Open
mphfish opened this issue Mar 7, 2023 · 1 comment
Open

distinct produces an erroneous error message #69

mphfish opened this issue Mar 7, 2023 · 1 comment
Labels
1.0.0 Issues/PR's related to the 1.0.0 release

Comments

@mphfish
Copy link

mphfish commented Mar 7, 2023

Snowflex does not properly account for Ecto passing in an order for distinct queries.

The following code:

MySchema
|> distinct([q], q.my_field)
|> Repo.all()

Produces this compiled Ecto query:

from a0 in MySchema,
  distinct: [asc: a0.my_field],
  select: a0

Snowflex crashes due to this line.

Snowflake does not natively support DISTINCT ON, which is where the order by becomes important. As such, we should probably just ignore the order values?

WORKAROUND:
If you pass in a select and only select 1 field, this will work as expected.

@mphfish mphfish added the 1.0.0 Issues/PR's related to the 1.0.0 release label Mar 7, 2023
@Ch4s3
Copy link
Contributor

Ch4s3 commented Jun 16, 2023

We should probably just specifically disallow this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0.0 Issues/PR's related to the 1.0.0 release
Projects
None yet
Development

No branches or pull requests

2 participants