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/11/09 01:30:14 UTC

[incubator-datasketches-cpp] branch cpc_template updated: new CPC sketch API

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

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


The following commit(s) were added to refs/heads/cpc_template by this push:
     new 65f18d0  new CPC sketch API
65f18d0 is described below

commit 65f18d04caaac0ba5ad9ac50c381da4a9b5e285a
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Fri Nov 8 17:30:04 2019 -0800

    new CPC sketch API
---
 python/src/cpc_wrapper.cpp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/python/src/cpc_wrapper.cpp b/python/src/cpc_wrapper.cpp
index 522b70b..e120c24 100644
--- a/python/src/cpc_wrapper.cpp
+++ b/python/src/cpc_wrapper.cpp
@@ -32,8 +32,7 @@ namespace python {
 
 cpc_sketch* cpc_sketch_deserialize(py::bytes skBytes) {
   std::string skStr = skBytes; // implicit cast
-  cpc_sketch_unique_ptr sk = cpc_sketch::deserialize(skStr.c_str(), skStr.length());
-  return sk.release();
+  return new cpc_sketch(cpc_sketch::deserialize(skStr.c_str(), skStr.length()));
 }
 
 py::object cpc_sketch_serialize(const cpc_sketch& sk) {
@@ -43,13 +42,12 @@ py::object cpc_sketch_serialize(const cpc_sketch& sk) {
 
 std::string cpc_sketch_to_string(const cpc_sketch& sk) {
   std::ostringstream ss;
-  ss << sk;
+  sk.to_stream(ss);
   return ss.str();
 }
 
 cpc_sketch* cpc_union_get_result(const cpc_union& u) {
-  auto sk = u.get_result();
-  return sk.release();
+  return new cpc_sketch(u.get_result());
 }
 
 }


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