Comments (5)
Thanks @PrettyWood !
Am I correct in thinking that we do want DISTINCT ON
in postgres, but there's a bug in ignoring the take 2
transform?
from prql.
I guess so
from prql.
No, we don't want DISTINCT ON
since that will pick only the first item in each GROUP BY partition.
The correct behavior would be to pick first two items in each partition. In SQL, this is only achievable by using ROW_NUMBER()
and WHERE
.
This is the problem here: https://github.com/prql/PRQL/blob/main/prqlc/prql-compiler/src/sql/srq/preprocess.rs#L172-L177
- we are checking if we should
take_only_first
, - we correctly apply this condition to
DISTINCT
, - we don't apply this condition to
DISTINCT ON
<-- this is the bug
from prql.
Oh, I didn't notice, you've opened a PR already.
from prql.
Oh, I didn't notice, you've opened a PR already.
Yeah and also realized my suggestion was wrong 😄
from prql.
Related Issues (20)
- Some aggregation functions need ORDER BY clause
- Unexpected result with s-string including UNNEST HOT 2
- Nightly tests failed HOT 1
- Nightly tests failed HOT 1
- RUSTSEC-2024-0336: `rustls::ConnectionCommon::complete_io` could fall into an infinite loop based on network input HOT 1
- Nightly tests failed
- Nightly tests failed
- Nightly tests failed HOT 1
- Compiler crash on `from_text` with zero rows HOT 4
- unexpected error on non-prql file HOT 1
- Add sampling extension support to PRQL HOT 3
- DISTINCT ON does not ensure columns exist HOT 1
- [Docker] the 'cargo' binary ... is not applicable to the '1.77.2-aarch64-unknown-linux-gnu' toolchain HOT 3
- Arrow type system as base for the type system HOT 1
- 'std' panics on lowering HOT 4
- Dev Container: can't run playground or book (can run website) HOT 24
- Incorrect Postgres interval syntax HOT 4
- Query optimization: join prunning and "uniqeness" HOT 3
- std.in operator does not support expression on left-hand-side HOT 2
- Named Unions as function parameters HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prql.