Presto: Bad error message for approx_distinct(boolean)

Created on 13 Nov 2018  Â·  4Comments  Â·  Source: prestodb/presto

```
presto> select approx_distinct(false);
Query 20181113_204447_00000_agpdr failed: Unsupported type parameters (BoundVariables{typeVariables={T=boolean}, longVariables={}}) for approx_distinct(T):bigint

beginner-task

Most helpful comment

I am aware. I am thinking about the case where someone generates approx_distinct(column) for every column in a table (for some reason).
Then adding approx_distinct support for booleans (which should in fact be exact) makes some sense.

All 4 comments

Is it bad error message? Or, maybe, approx_distinct(boolean) could be supported?

We could certainly support it for completeness, but it’s a little nonsensical. The “approx” part of the function is to deal with large cardinalities within a limited memory budget. For booleans, it’s trivial to do it exactly and with constant memory, so the “approx” notion would be misleading.

I am aware. I am thinking about the case where someone generates approx_distinct(column) for every column in a table (for some reason).
Then adding approx_distinct support for booleans (which should in fact be exact) makes some sense.

Was this page helpful?
0 / 5 - 0 ratings