Repository navigation
[SQL] Support the PostgresSQL extension DISTINCT ON - #7904
Conversation
|
What I ran: bug (high): missing (medium): test coverage. I wrote these QA cases as incremental tests (
The PR's @Test
public void distinctOnIncremental() {
var ccs = this.getCCS("""
CREATE TABLE T(a INT, b INT, c INT);
CREATE VIEW V AS SELECT DISTINCT ON (a) a, b, c FROM T ORDER BY a, b DESC;""");
ccs.step("INSERT INTO T VALUES (1, 1, 10), (1, 2, 20), (2, 5, 30);", """
a | b | c | weight
---------------------
1 | 2 | 20 | 1
2 | 5 | 30 | 1""");
ccs.step("INSERT INTO T VALUES (1, 3, 40);", """
a | b | c | weight
---------------------
1 | 2 | 20 | -1
1 | 3 | 40 | 1""");
ccs.step("REMOVE FROM T VALUES (1, 3, 40);", """
a | b | c | weight
---------------------
1 | 3 | 40 | -1
1 | 2 | 20 | 1""");
}Also, this PR still contains the UNNEST commit from #6599, so it should be rebased once #6599 merges. |
1329c63 to
6bbfd6d
Compare
…. = 1' Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
Fixes #7644 Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
6bbfd6d to
60fface
Compare
Linked Issue
Fixes #7644
This branch is rebased already on #6599 which advances the Calcite version, and which is supposed to merge first.
Calcite already rewrites DISTINCT ON into other operators we support; this PR just enables the transformation and adds tests.
Checklist