You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by al...@apache.org on 2023/11/14 00:03:27 UTC
(datasketches-postgresql) branch cpp-5.0.0 created (now e292d88)
This is an automated email from the ASF dual-hosted git repository.
alsay pushed a change to branch cpp-5.0.0
in repository https://gitbox.apache.org/repos/asf/datasketches-postgresql.git
at e292d88 use datasketches-cpp 5.0.0
This branch includes the following new commits:
new e292d88 use datasketches-cpp 5.0.0
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
(datasketches-postgresql) 01/01: use datasketches-cpp 5.0.0
Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
alsay pushed a commit to branch cpp-5.0.0
in repository https://gitbox.apache.org/repos/asf/datasketches-postgresql.git
commit e292d88bed11a8346b5a6bc52e079c35774a045e
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Mon Nov 13 16:03:04 2023 -0800
use datasketches-cpp 5.0.0
---
Dockerfile | 2 +-
package.sh | 2 +-
src/aod_sketch_c_adapter.cpp | 16 +++++++---------
src/kll_double_sketch_c_adapter.cpp | 3 +--
src/kll_float_sketch_c_adapter.cpp | 3 +--
src/quantiles_double_sketch_c_adapter.cpp | 3 +--
src/req_float_sketch_c_adapter.cpp | 3 +--
7 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 48c8d58..488c2ae 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -18,7 +18,7 @@
ARG BASE_IMAGE_VERSION=latest
ARG DATASKETCHES_CPP_HASH=8135b65408947694e13bd131038889e439847aa2
-ARG DATASKETCHES_CPP_VERSION=4.1.0
+ARG DATASKETCHES_CPP_VERSION=5.0.0
FROM postgres:$BASE_IMAGE_VERSION
diff --git a/package.sh b/package.sh
index 2e876c0..1c2315e 100755
--- a/package.sh
+++ b/package.sh
@@ -32,7 +32,7 @@ if [ -z $2 ]; then
fi
# version of datasketches-cpp core library to include
-CORETAG=4.1.0
+CORETAG=5.0.0
DST=datasketches-$VER
diff --git a/src/aod_sketch_c_adapter.cpp b/src/aod_sketch_c_adapter.cpp
index 0147c51..48fe9f2 100644
--- a/src/aod_sketch_c_adapter.cpp
+++ b/src/aod_sketch_c_adapter.cpp
@@ -23,9 +23,6 @@
#include "kll_float_sketch_c_adapter.h"
#include <array_of_doubles_sketch.hpp>
-#include <array_of_doubles_union.hpp>
-#include <array_of_doubles_intersection.hpp>
-#include <array_of_doubles_a_not_b.hpp>
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/stats.hpp>
@@ -33,14 +30,15 @@
#include <boost/accumulators/statistics/variance.hpp>
#include <boost/math/distributions/students_t.hpp>
-using update_aod_sketch_pg = datasketches::update_array_of_doubles_sketch_alloc<palloc_allocator<double>>;
-using compact_aod_sketch_pg = datasketches::compact_array_of_doubles_sketch_alloc<palloc_allocator<double>>;
-using aod_union_pg = datasketches::array_of_doubles_union_alloc<palloc_allocator<double>>;
+using aod = datasketches::array<double, palloc_allocator<double>>;
+using update_aod_sketch_pg = datasketches::update_array_tuple_sketch<aod>;
+using compact_aod_sketch_pg = datasketches::compact_array_tuple_sketch<aod>;
+using aod_union_pg = datasketches::array_tuple_union<aod>;
// using the union policy in the intersection since this is how it is done in Druid
-using aod_intersection_pg = datasketches::array_of_doubles_intersection<datasketches::array_of_doubles_union_policy_alloc<palloc_allocator<double>>, palloc_allocator<double>>;
-using aod_a_not_b_pg = datasketches::array_of_doubles_a_not_b_alloc<palloc_allocator<double>>;
+using aod_intersection_pg = datasketches::array_tuple_intersection<aod, datasketches::default_array_tuple_union_policy<aod>>;
+using aod_a_not_b_pg = datasketches::array_tuple_a_not_b<aod>;
-std::ostream& operator<<(std::ostream& os, const datasketches::aod<palloc_allocator<double>>& v) {
+std::ostream& operator<<(std::ostream& os, const aod& v) {
os << "(";
for (size_t i = 0; i < v.size(); ++i) {
if (i != 0) os << ", ";
diff --git a/src/kll_double_sketch_c_adapter.cpp b/src/kll_double_sketch_c_adapter.cpp
index db352bb..4aa5306 100644
--- a/src/kll_double_sketch_c_adapter.cpp
+++ b/src/kll_double_sketch_c_adapter.cpp
@@ -155,10 +155,9 @@ Datum* kll_double_sketch_get_pmf_or_cdf(const void* sketchptr, const double* spl
Datum* kll_double_sketch_get_quantiles(const void* sketchptr, const double* fractions, unsigned num_fractions) {
try {
- auto array = static_cast<const kll_double_sketch*>(sketchptr)->get_quantiles(fractions, num_fractions);
Datum* quantiles = (Datum*) palloc(sizeof(Datum) * num_fractions);
for (unsigned i = 0; i < num_fractions; i++) {
- quantiles[i] = pg_float8_get_datum(array[i]);
+ quantiles[i] = pg_float8_get_datum(static_cast<const kll_double_sketch*>(sketchptr)->get_quantile(fractions[i]));
}
return quantiles;
} catch (std::exception& e) {
diff --git a/src/kll_float_sketch_c_adapter.cpp b/src/kll_float_sketch_c_adapter.cpp
index 230348f..30a4bdc 100644
--- a/src/kll_float_sketch_c_adapter.cpp
+++ b/src/kll_float_sketch_c_adapter.cpp
@@ -155,10 +155,9 @@ Datum* kll_float_sketch_get_pmf_or_cdf(const void* sketchptr, const float* split
Datum* kll_float_sketch_get_quantiles(const void* sketchptr, const double* fractions, unsigned num_fractions) {
try {
- auto array = static_cast<const kll_float_sketch*>(sketchptr)->get_quantiles(fractions, num_fractions);
Datum* quantiles = (Datum*) palloc(sizeof(Datum) * num_fractions);
for (unsigned i = 0; i < num_fractions; i++) {
- quantiles[i] = pg_float4_get_datum(array[i]);
+ quantiles[i] = pg_float4_get_datum(static_cast<const kll_float_sketch*>(sketchptr)->get_quantile(fractions[i]));
}
return quantiles;
} catch (std::exception& e) {
diff --git a/src/quantiles_double_sketch_c_adapter.cpp b/src/quantiles_double_sketch_c_adapter.cpp
index 958fbca..7be602e 100644
--- a/src/quantiles_double_sketch_c_adapter.cpp
+++ b/src/quantiles_double_sketch_c_adapter.cpp
@@ -155,10 +155,9 @@ Datum* quantiles_double_sketch_get_pmf_or_cdf(const void* sketchptr, const doubl
Datum* quantiles_double_sketch_get_quantiles(const void* sketchptr, const double* fractions, unsigned num_fractions) {
try {
- auto array = static_cast<const quantiles_double_sketch*>(sketchptr)->get_quantiles(fractions, num_fractions);
Datum* quantiles = (Datum*) palloc(sizeof(Datum) * num_fractions);
for (unsigned i = 0; i < num_fractions; i++) {
- quantiles[i] = pg_float8_get_datum(array[i]);
+ quantiles[i] = pg_float8_get_datum(static_cast<const quantiles_double_sketch*>(sketchptr)->get_quantile(fractions[i]));
}
return quantiles;
} catch (std::exception& e) {
diff --git a/src/req_float_sketch_c_adapter.cpp b/src/req_float_sketch_c_adapter.cpp
index d5b4319..c8439bd 100644
--- a/src/req_float_sketch_c_adapter.cpp
+++ b/src/req_float_sketch_c_adapter.cpp
@@ -155,10 +155,9 @@ Datum* req_float_sketch_get_pmf_or_cdf(const void* sketchptr, const float* split
Datum* req_float_sketch_get_quantiles(const void* sketchptr, const double* fractions, unsigned num_fractions, bool inclusive) {
try {
- auto array = static_cast<const req_float_sketch*>(sketchptr)->get_quantiles(fractions, num_fractions, inclusive);
Datum* quantiles = (Datum*) palloc(sizeof(Datum) * num_fractions);
for (unsigned i = 0; i < num_fractions; i++) {
- quantiles[i] = pg_float4_get_datum(array[i]);
+ quantiles[i] = pg_float4_get_datum(static_cast<const req_float_sketch*>(sketchptr)->get_quantile(fractions[i]));
}
return quantiles;
} catch (std::exception& e) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org