use datasketches-cpp 5.0.0
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 @@
 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_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_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_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_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) {