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/08/15 23:02:13 UTC

[incubator-datasketches-postgresql] 01/01: new naming convention

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

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

commit 61f603c2f22b569fad9855d40965e947962dc5d7
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Thu Aug 15 16:01:36 2019 -0700

    new naming convention
---
 src/hll_sketch_c_adapter.cpp | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/hll_sketch_c_adapter.cpp b/src/hll_sketch_c_adapter.cpp
index af4e1f9..b082d88 100644
--- a/src/hll_sketch_c_adapter.cpp
+++ b/src/hll_sketch_c_adapter.cpp
@@ -25,8 +25,8 @@
 
 #include <hll.hpp>
 
-typedef datasketches::HllSketch<palloc_allocator<char>> hll_sketch_pg;
-typedef datasketches::HllUnion<palloc_allocator<char>> hll_union_pg;
+typedef datasketches::hll_sketch_alloc<palloc_allocator<char>> hll_sketch_pg;
+typedef datasketches::hll_union_alloc<palloc_allocator<char>> hll_union_pg;
 
 void* hll_sketch_new(unsigned lg_k) {
   try {
@@ -41,7 +41,7 @@ void* hll_sketch_new_tgt_type(unsigned lg_k, unsigned tgt_type) {
   try {
     return new (palloc(sizeof(hll_sketch_pg))) hll_sketch_pg(
       lg_k,
-      tgt_type == 4 ? datasketches::TgtHllType::HLL_4 : tgt_type == 6 ? datasketches::TgtHllType::HLL_6 : datasketches::TgtHllType::HLL_8
+      tgt_type == 4 ? datasketches::target_hll_type::HLL_4 : tgt_type == 6 ? datasketches::target_hll_type::HLL_6 : datasketches::target_hll_type::HLL_8
     );
   } catch (std::exception& e) {
     pg_error(e.what());
@@ -68,7 +68,7 @@ void hll_sketch_update(void* sketchptr, const void* data, unsigned length) {
 
 double hll_sketch_get_estimate(const void* sketchptr) {
   try {
-    return static_cast<const hll_sketch_pg*>(sketchptr)->getEstimate();
+    return static_cast<const hll_sketch_pg*>(sketchptr)->get_estimate();
   } catch (std::exception& e) {
     pg_error(e.what());
   }
@@ -78,9 +78,9 @@ double hll_sketch_get_estimate(const void* sketchptr) {
 Datum* hll_sketch_get_estimate_and_bounds(const void* sketchptr, unsigned num_std_devs) {
   try {
     Datum* est_and_bounds = (Datum*) palloc(sizeof(Datum) * 3);
-    est_and_bounds[0] = pg_float8_get_datum(static_cast<const hll_sketch_pg*>(sketchptr)->getEstimate());
-    est_and_bounds[1] = pg_float8_get_datum(static_cast<const hll_sketch_pg*>(sketchptr)->getLowerBound(num_std_devs));
-    est_and_bounds[2] = pg_float8_get_datum(static_cast<const hll_sketch_pg*>(sketchptr)->getUpperBound(num_std_devs));
+    est_and_bounds[0] = pg_float8_get_datum(static_cast<const hll_sketch_pg*>(sketchptr)->get_estimate());
+    est_and_bounds[1] = pg_float8_get_datum(static_cast<const hll_sketch_pg*>(sketchptr)->get_lower_bound(num_std_devs));
+    est_and_bounds[2] = pg_float8_get_datum(static_cast<const hll_sketch_pg*>(sketchptr)->get_upper_bound(num_std_devs));
     return est_and_bounds;
   } catch (std::exception& e) {
     pg_error(e.what());
@@ -101,7 +101,7 @@ void hll_sketch_to_string(const void* sketchptr, char* buffer, unsigned length)
 ptr_with_size hll_sketch_serialize(const void* sketchptr, unsigned header_size) {
   try {
     ptr_with_size p;
-    auto data = static_cast<const hll_sketch_pg*>(sketchptr)->serializeCompact(header_size);
+    auto data = static_cast<const hll_sketch_pg*>(sketchptr)->serialize_compact(header_size);
     p.ptr = data.first.release();
     p.size = data.second;
     return p;
@@ -149,7 +149,7 @@ void hll_union_update(void* unionptr, const void* sketchptr) {
 
 void* hll_union_get_result(void* unionptr) {
   try {
-    return new (palloc(sizeof(hll_sketch_pg))) hll_sketch_pg(static_cast<hll_union_pg*>(unionptr)->getResult());
+    return new (palloc(sizeof(hll_sketch_pg))) hll_sketch_pg(static_cast<hll_union_pg*>(unionptr)->get_result());
   } catch (std::exception& e) {
     pg_error(e.what());
   }
@@ -158,8 +158,8 @@ void* hll_union_get_result(void* unionptr) {
 
 void* hll_union_get_result_tgt_type(void* unionptr, unsigned tgt_type) {
   try {
-    return new (palloc(sizeof(hll_sketch_pg))) hll_sketch_pg(static_cast<hll_union_pg*>(unionptr)->getResult(
-      tgt_type == 4 ? datasketches::TgtHllType::HLL_4 : tgt_type == 6 ? datasketches::TgtHllType::HLL_6 : datasketches::TgtHllType::HLL_8
+    return new (palloc(sizeof(hll_sketch_pg))) hll_sketch_pg(static_cast<hll_union_pg*>(unionptr)->get_result(
+      tgt_type == 4 ? datasketches::target_hll_type::HLL_4 : tgt_type == 6 ? datasketches::target_hll_type::HLL_6 : datasketches::target_hll_type::HLL_8
     ));
   } catch (std::exception& e) {
     pg_error(e.what());


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