Why is the following query is returning the wrong ...
# troubleshooting
r
Why is the following query is returning the wrong result? The cardinality of d1 is 3K and the cardinality of d2 is 200k. numSegmentsMatched is 1. numGroupsLimitReached is false.
Copy code
select d1, d2, max(metric) as max_metric
from t
where datetrunc('DAY', created_at_epoch_ms) = 1660867200000
group by d1, d2
order by max_metric desc
limit 1
m
How did you validate it is wrong?
r
I first started with grouping by one dimension at a time and got the same max_metric value which is much higher than the value returned when grouping by both.
I can get the expected result if I filter by one dimension and group by the other.
m
Grouping by one is different from grouping by two and not expected to match
r
I agree in general. But given I know which combination of dimensions yields the max, grouping by both should work.
m
If you are convinced it is a bug then please file a GH issue with a test case.
r
This isn't a critical issue yet. If it becomes critical then I'll follow up with you about how to submit a GH issue.