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

Wrong number of template arguments #62

Closed shubhamsachdeva89 closed 1 year ago

shubhamsachdeva89 commented 1 year ago

Hi,

I'm trying to install new version of datasketches in our postgres instance. I have downloaded datasketches-postgresql 1.5.0 (apache-datasketches-postgresql-1.5.0-src.zip), datasketches-cpp 4.0.1 (apache-datasketches-cpp-4.0.1-src.zip) from apache website and boost 1.81.0. I have followed the same steps as mentioned in the readme file. While executing the make command, I faced an error:

g++ -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -std=c++11 -fPIC -fPIC -I/usr/local/include -Iboost -Idatasketches-cpp/common/include -Idatasketches-cpp/kll/include -Idatasketches-cpp/cpc/include -Idatasketches-cpp/theta/include -Idatasketches-cpp/fi/include -Idatasketches-cpp/hll/include -Idatasketches-cpp/tuple/include -Idatasketches-cpp/req/include -I. -I./ -I/pgbin/mbi1d/12.x/include/postgresql/server -I/pgbin/mbi1d/12.x/include/postgresql/internal -D_GNU_SOURCE -I/pgbin/mbi1d/12.x//include/libxml2 -c -o src/kll_float_sketch_c_adapter.o src/kll_float_sketch_c_adapter.cpp src/kll_float_sketch_c_adapter.cpp:26:109: error: wrong number of template arguments (4, should be 3) typedef datasketches::kll_sketch<float, std::less, datasketches::serde, palloc_allocator> kll_float_sketch; ^ In file included from src/kll_float_sketch_c_adapter.cpp:24:0: datasketches-cpp/kll/include/kll_sketch.hpp:158:7: error: provided for ‘template<class T, class C, class A> class datasketches::kll_sketch’ class kll_sketch {

Looks like there is a mismatch of arguments in kll_float_sketch_c_adapter.cpp and kll_sketch.hpp. Could you please suggest a solution. Thank you!

jmalkin commented 1 year ago

Looking at the postgresql release date for 1.5.0, the issue is that it's designed for datasketches-cpp 3.x. We use semantic versioning so the expectation is that the 4.x version of the c++ library has API incompatibilities.

It's only recently that we've received really any feedback on postgresql, so we'd largely assumed that it was mostly ignored. There are improvements in the works but I don't think we have a specific target date for a new release yet.

shubhamsachdeva89 commented 1 year ago

Hi Jon,

Thank you so much for your response. In the latest commit in kll_float_sketch_c_adapter.cpp which was done in Nov 18, 2022, Serde parameter was removed which I guess will make it compatible with kll_sketch.hpp but Its not released yet.

Currently, We are using 1.3.0 version of datasketches in postgres and we only use HLL sketch algorithm to count distinct. Is there any upgrade for HLL from 1.3.0 to 1.5.0? or we can live with 1.3.0 for now and wait for next official release which solves all these issues.

Please let me know. Thank you!

AlexanderSaydakov commented 1 year ago

Is there any upgrade for HLL from 1.3.0 to 1.5.0?

Yes, upgrade scripts are here: https://github.com/apache/datasketches-postgresql/tree/master/sql datasketches--1.3.0--1.4.0.sql datasketches--1.4.0--1.5.0.sql

jmalkin commented 1 year ago

Just as an update, we're working on a c++ release and, once that's done, we'll start the release process for this project.

AlexanderSaydakov commented 1 year ago

1.6.0-rc1 release candidate is out there. The vote is open. You are welcome to participate. The best way to ensure your interests are taken into account is to be a part of the process.

AlexanderSaydakov commented 1 year ago

1.6.0 has been released

jmalkin commented 1 year ago

The full release notes are available here: https://github.com/apache/datasketches-postgresql/releases/tag/1.6.0

We didn't include this as a fix in the notes as it was a mismatch between incompatible versions rather than a code bug. Either way, using the newer version will support the most recent sketches library and provide other performance improvements.