fix: skip replacing exprs of the DistinctOn node (#5823)

* fix: handle distinct on specially

* chore: update comment
This commit is contained in:
Yingwen
2025-04-07 16:59:40 +08:00
committed by GitHub
parent 917510ffd0
commit 21a209f7ba
6 changed files with 42 additions and 9 deletions

View File

@@ -69,6 +69,15 @@ SELECT DISTINCT CASE WHEN a > 11 THEN 11 ELSE a END FROM test;
| 11 |
+-------------------------------------------------------------+
SELECT DISTINCT ON (a) * FROM test ORDER BY a, t DESC;
+----+----+-------------------------+
| a | b | t |
+----+----+-------------------------+
| 11 | 22 | 1970-01-01T00:00:00.004 |
| 13 | 22 | 1970-01-01T00:00:00.002 |
+----+----+-------------------------+
DROP TABLE test;
Affected Rows: 0

View File

@@ -16,4 +16,6 @@ SELECT DISTINCT MAX(b) FROM test GROUP BY a;
SELECT DISTINCT CASE WHEN a > 11 THEN 11 ELSE a END FROM test;
SELECT DISTINCT ON (a) * FROM test ORDER BY a, t DESC;
DROP TABLE test;