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 2019/06/06 01:45:15 UTC

[incubator-datasketches-postgresql] 01/04: adapt to core API changes

This is an automated email from the ASF dual-hosted git repository.

alsay pushed a commit to branch theta
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-postgresql.git

commit d1f3b472dd9a06b193aeb93ff19ff14510e1cd97
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Mon Jun 3 16:22:41 2019 -0700

    adapt to core API changes
---
 src/kll_float_sketch_c_adapter.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/kll_float_sketch_c_adapter.cpp b/src/kll_float_sketch_c_adapter.cpp
index 12accc7..a73ba23 100644
--- a/src/kll_float_sketch_c_adapter.cpp
+++ b/src/kll_float_sketch_c_adapter.cpp
@@ -10,7 +10,7 @@
 
 #include <kll_sketch.hpp>
 
-typedef datasketches::kll_sketch<float, palloc_allocator<void>> kll_float_sketch;
+typedef datasketches::kll_sketch<float, std::less<float>, datasketches::serde<float>, palloc_allocator<float>> kll_float_sketch;
 
 void* kll_float_sketch_new(unsigned k) {
   try {
@@ -72,7 +72,7 @@ uint64 kll_float_sketch_get_n(const void* sketchptr) {
 void kll_float_sketch_to_string(const void* sketchptr, char* buffer, unsigned length) {
   try {
     std::stringstream s;
-    s << *(static_cast<const kll_float_sketch*>(sketchptr));
+    static_cast<const kll_float_sketch*>(sketchptr)->to_stream(s);
     snprintf(buffer, length, s.str().c_str());
   } catch (std::exception& e) {
     elog(ERROR, e.what());
@@ -93,8 +93,7 @@ void* kll_float_sketch_serialize(const void* sketchptr) {
 
 void* kll_float_sketch_deserialize(const char* buffer, unsigned length) {
   try {
-    auto ptr = kll_float_sketch::deserialize(buffer, length);
-    return ptr.release();
+    return new (palloc(sizeof(kll_float_sketch))) kll_float_sketch(kll_float_sketch::deserialize(buffer, length));
   } catch (std::exception& e) {
     elog(ERROR, e.what());
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org