apache / datasketches-postgresql

PostgreSQL extension providing approximate algorithms based on apache/datasketches-cpp
https://datasketches.apache.org
Apache License 2.0
84 stars 11 forks source link

set intersection is not working for aggregation #34

Closed chongdae closed 3 years ago

chongdae commented 3 years ago

theta_sketch_union is working well.

with d1 as (
    select id, theta_sketch_build(val) sketch
    from (values (1, 1), (1, 2), (1, 3), (2, 2), (2, 3), (2, 4)) as t(id, val)
    group by id
)
select
    theta_sketch_get_estimate(theta_sketch_union(sketch)) agg
from d1
;

But theta_sketch_intersection is not working.

with d1 as (
    select id, theta_sketch_build(val) sketch
    from (values (1, 1), (1, 2), (1, 3), (2, 2), (2, 3), (2, 4)) as t(id, val)
    group by id
)
select
    theta_sketch_get_estimate(theta_sketch_intersection(sketch)) agg
from d1
;
AlexanderSaydakov commented 3 years ago

What result are you getting? What version of PostgreSQL and datasketches-postgresql are you running?

chongdae commented 3 years ago

I'm using "PostgreSQL 11.7 (EnterpriseDB Advanced Server 11.7.14)" and daasketches-postgresql 1.3.0 stable release from https://pgxn.org/dist/datasketches/ .

First query returns "4", but second query returns error message:

SQL Error [42883]: ERROR: function theta_sketch_intersection(theta_sketch) does not exist
  Hint: No function matches the given name and argument types. You might need to add explicit type casts.
  Position: 182
AlexanderSaydakov commented 3 years ago

I see, this was fixed by #26, and we did not have a release after that

AlexanderSaydakov commented 3 years ago

Is it acceptable for you to build from the master? Perhaps we could do 1.3.1 maintenance release, but we graduated, and I don't quite like the idea of releasing from this old branch which still has incubator tags. And the next big release is not quite ready. We are still working on a couple of things in the core library.