opteryx icon indicating copy to clipboard operation
opteryx copied to clipboard

🪲 COUNT(*) with literal returns incorrect result

Open joocer opened this issue 10 months ago • 1 comments

SELECT 1, COUNT(*) AS c FROM hits GROUP BY 1 ORDER BY c DESC LIMIT 10;

returns COUNT(*) as 100, which is the number of files, not the number of rows.

joocer avatar Jan 16 '25 00:01 joocer

what appears to be happening is the GROUP BY 1 is partially removed and the optimization for COUNT(*) with no groupings isn't evaluated correctly.

joocer avatar Jan 16 '25 09:01 joocer