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/12/17 18:48:13 UTC

[incubator-datasketches-cpp] branch api_vector updated (c91c98f -> 7cea129)

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

alsay pushed a change to branch api_vector
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-cpp.git.


    from c91c98f  return vectors, use common memory copy functions
     new 01dadc2  back to void pointer
     new 7cea129  use new interface in python wrappers

The 2 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.


Summary of changes:
 cpc/include/cpc_sketch.hpp      | 2 +-
 cpc/include/cpc_sketch_impl.hpp | 6 +++---
 python/src/cpc_wrapper.cpp      | 2 +-
 python/src/fi_wrapper.cpp       | 2 +-
 python/src/hll_wrapper.cpp      | 8 ++++----
 python/src/kll_wrapper.cpp      | 2 +-
 python/src/theta_wrapper.cpp    | 2 +-
 7 files changed, 12 insertions(+), 12 deletions(-)


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


[incubator-datasketches-cpp] 01/02: back to void pointer

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 01dadc2f74f478a588da1578ad07ed50ba998567
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Tue Dec 17 10:47:18 2019 -0800

    back to void pointer
---
 cpc/include/cpc_sketch.hpp      | 2 +-
 cpc/include/cpc_sketch_impl.hpp | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cpc/include/cpc_sketch.hpp b/cpc/include/cpc_sketch.hpp
index 9fd19c5..e408406 100644
--- a/cpc/include/cpc_sketch.hpp
+++ b/cpc/include/cpc_sketch.hpp
@@ -102,7 +102,7 @@ class cpc_sketch_alloc {
     vector_u8<A> serialize(unsigned header_size_bytes = 0) const;
 
     static cpc_sketch_alloc<A> deserialize(std::istream& is, uint64_t seed = DEFAULT_SEED);
-    static cpc_sketch_alloc<A> deserialize(const uint8_t* bytes, size_t size, uint64_t seed = DEFAULT_SEED);
+    static cpc_sketch_alloc<A> deserialize(const void* bytes, size_t size, uint64_t seed = DEFAULT_SEED);
 
     // for internal use
     uint32_t get_num_coupons() const;
diff --git a/cpc/include/cpc_sketch_impl.hpp b/cpc/include/cpc_sketch_impl.hpp
index ed804a7..58eb108 100644
--- a/cpc/include/cpc_sketch_impl.hpp
+++ b/cpc/include/cpc_sketch_impl.hpp
@@ -586,8 +586,8 @@ cpc_sketch_alloc<A> cpc_sketch_alloc<A>::deserialize(std::istream& is, uint64_t
 }
 
 template<typename A>
-cpc_sketch_alloc<A> cpc_sketch_alloc<A>::deserialize(const uint8_t* bytes, size_t size, uint64_t seed) {
-  const uint8_t* ptr = bytes;
+cpc_sketch_alloc<A> cpc_sketch_alloc<A>::deserialize(const void* bytes, size_t size, uint64_t seed) {
+  const char* ptr = static_cast<const char*>(bytes);
   uint8_t preamble_ints;
   ptr += copy_from_mem(ptr, &preamble_ints, sizeof(preamble_ints));
   uint8_t serial_version;
@@ -641,7 +641,7 @@ cpc_sketch_alloc<A> cpc_sketch_alloc<A>::deserialize(const uint8_t* bytes, size_
     }
     if (!has_window) compressed.table_num_entries = num_coupons;
   }
-  if (ptr != bytes + size) throw std::logic_error("deserialized size mismatch");
+  if (ptr != static_cast<const char*>(bytes) + size) throw std::logic_error("deserialized size mismatch");
 
   uint8_t expected_preamble_ints = get_preamble_ints(num_coupons, has_hip, has_table, has_window);
   if (preamble_ints != expected_preamble_ints) {


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


[incubator-datasketches-cpp] 02/02: use new interface in python wrappers

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7cea129b5f3d2eef633a6a5b69451f9a1255f971
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Tue Dec 17 10:48:02 2019 -0800

    use new interface in python wrappers
---
 python/src/cpc_wrapper.cpp   | 2 +-
 python/src/fi_wrapper.cpp    | 2 +-
 python/src/hll_wrapper.cpp   | 8 ++++----
 python/src/kll_wrapper.cpp   | 2 +-
 python/src/theta_wrapper.cpp | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/python/src/cpc_wrapper.cpp b/python/src/cpc_wrapper.cpp
index e120c24..9031ba4 100644
--- a/python/src/cpc_wrapper.cpp
+++ b/python/src/cpc_wrapper.cpp
@@ -37,7 +37,7 @@ cpc_sketch* cpc_sketch_deserialize(py::bytes skBytes) {
 
 py::object cpc_sketch_serialize(const cpc_sketch& sk) {
   auto serResult = sk.serialize();
-  return py::bytes((char*)serResult.first.get(), serResult.second);
+  return py::bytes((char*)serResult.data(), serResult.size());
 }
 
 std::string cpc_sketch_to_string(const cpc_sketch& sk) {
diff --git a/python/src/fi_wrapper.cpp b/python/src/fi_wrapper.cpp
index 92bc2b9..271ce83 100644
--- a/python/src/fi_wrapper.cpp
+++ b/python/src/fi_wrapper.cpp
@@ -36,7 +36,7 @@ frequent_items_sketch<T> fi_sketch_deserialize(py::bytes skBytes) {
 template<typename T>
 py::object fi_sketch_serialize(const frequent_items_sketch<T>& sk) {
   auto serResult = sk.serialize();
-  return py::bytes((char*)serResult.first.get(), serResult.second);
+  return py::bytes((char*)serResult.data(), serResult.size());
 }
 
 // maybe possible to disambiguate the static vs method get_epsilon calls, but
diff --git a/python/src/hll_wrapper.cpp b/python/src/hll_wrapper.cpp
index 4accbe9..24b3530 100644
--- a/python/src/hll_wrapper.cpp
+++ b/python/src/hll_wrapper.cpp
@@ -33,12 +33,12 @@ hll_sketch hll_sketch_deserialize(py::bytes skBytes) {
 
 py::object hll_sketch_serialize_compact(const hll_sketch& sk) {
   auto serResult = sk.serialize_compact();
-  return py::bytes((char*)serResult.first.get(), serResult.second);
+  return py::bytes((char*)serResult.data(), serResult.size());
 }
 
 py::object hll_sketch_serialize_updatable(const hll_sketch& sk) {
   auto serResult = sk.serialize_updatable();
-  return py::bytes((char*)serResult.first.get(), serResult.second);
+  return py::bytes((char*)serResult.data(), serResult.size());
 }
 
 hll_union hll_union_deserialize(py::bytes uBytes) {
@@ -48,12 +48,12 @@ hll_union hll_union_deserialize(py::bytes uBytes) {
 
 py::object hll_union_serialize_compact(const hll_union& u) {
   auto serResult = u.serialize_compact();
-  return py::bytes((char*)serResult.first.get(), serResult.second);
+  return py::bytes((char*)serResult.data(), serResult.size());
 }
 
 py::object hll_union_serialize_updatable(const hll_union& u) {
   auto serResult = u.serialize_updatable();
-  return py::bytes((char*)serResult.first.get(), serResult.second);
+  return py::bytes((char*)serResult.data(), serResult.size());
 }
 
 }
diff --git a/python/src/kll_wrapper.cpp b/python/src/kll_wrapper.cpp
index 120c3dd..0740f11 100644
--- a/python/src/kll_wrapper.cpp
+++ b/python/src/kll_wrapper.cpp
@@ -37,7 +37,7 @@ kll_sketch<T> kll_sketch_deserialize(py::bytes skBytes) {
 template<typename T>
 py::object kll_sketch_serialize(const kll_sketch<T>& sk) {
   auto serResult = sk.serialize();
-  return py::bytes((char*)serResult.first.get(), serResult.second);
+  return py::bytes((char*)serResult.data(), serResult.size());
 }
 
 // maybe possible to disambiguate the static vs method rank error calls, but
diff --git a/python/src/theta_wrapper.cpp b/python/src/theta_wrapper.cpp
index 9ec2335..5eb27e8 100644
--- a/python/src/theta_wrapper.cpp
+++ b/python/src/theta_wrapper.cpp
@@ -54,7 +54,7 @@ theta_sketch* theta_sketch_deserialize(py::bytes skBytes,
 
 py::object theta_sketch_serialize(const theta_sketch& sk) {
   auto serResult = sk.serialize();
-  return py::bytes((char*)serResult.first.get(), serResult.second);
+  return py::bytes((char*)serResult.data(), serResult.size());
 }
 
 std::string theta_sketch_to_string(const theta_sketch& sk,


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