datasketches 0.2.5 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/LICENSE +4 -6
  4. data/NOTICE +6 -5
  5. data/ext/datasketches/kll_wrapper.cpp +2 -2
  6. data/lib/datasketches/version.rb +1 -1
  7. data/vendor/datasketches-cpp/CMakeLists.txt +1 -1
  8. data/vendor/datasketches-cpp/LICENSE +4 -6
  9. data/vendor/datasketches-cpp/MANIFEST.in +0 -2
  10. data/vendor/datasketches-cpp/NOTICE +6 -5
  11. data/vendor/datasketches-cpp/common/CMakeLists.txt +2 -2
  12. data/vendor/datasketches-cpp/common/test/CMakeLists.txt +13 -2
  13. data/vendor/datasketches-cpp/common/test/catch_runner.cpp +22 -1
  14. data/vendor/datasketches-cpp/common/test/integration_test.cpp +1 -1
  15. data/vendor/datasketches-cpp/cpc/include/cpc_compressor_impl.hpp +2 -1
  16. data/vendor/datasketches-cpp/cpc/test/compression_test.cpp +1 -1
  17. data/vendor/datasketches-cpp/cpc/test/cpc_sketch_allocation_test.cpp +1 -1
  18. data/vendor/datasketches-cpp/cpc/test/cpc_sketch_test.cpp +1 -1
  19. data/vendor/datasketches-cpp/cpc/test/cpc_union_test.cpp +1 -1
  20. data/vendor/datasketches-cpp/fi/include/reverse_purge_hash_map_impl.hpp +1 -1
  21. data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_custom_type_test.cpp +1 -1
  22. data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_test.cpp +1 -1
  23. data/vendor/datasketches-cpp/fi/test/reverse_purge_hash_map_test.cpp +1 -1
  24. data/vendor/datasketches-cpp/hll/test/AuxHashMapTest.cpp +1 -1
  25. data/vendor/datasketches-cpp/hll/test/CouponHashSetTest.cpp +1 -1
  26. data/vendor/datasketches-cpp/hll/test/CouponListTest.cpp +1 -1
  27. data/vendor/datasketches-cpp/hll/test/CrossCountingTest.cpp +1 -1
  28. data/vendor/datasketches-cpp/hll/test/HllArrayTest.cpp +1 -1
  29. data/vendor/datasketches-cpp/hll/test/HllSketchTest.cpp +1 -1
  30. data/vendor/datasketches-cpp/hll/test/HllUnionTest.cpp +1 -1
  31. data/vendor/datasketches-cpp/hll/test/IsomorphicTest.cpp +1 -1
  32. data/vendor/datasketches-cpp/hll/test/TablesTest.cpp +1 -1
  33. data/vendor/datasketches-cpp/hll/test/ToFromByteArrayTest.cpp +1 -1
  34. data/vendor/datasketches-cpp/kll/include/kll_helper_impl.hpp +2 -2
  35. data/vendor/datasketches-cpp/kll/include/kll_sketch.hpp +22 -9
  36. data/vendor/datasketches-cpp/kll/include/kll_sketch_impl.hpp +47 -9
  37. data/vendor/datasketches-cpp/kll/test/kll_sketch_custom_type_test.cpp +1 -1
  38. data/vendor/datasketches-cpp/kll/test/kll_sketch_test.cpp +72 -7
  39. data/vendor/datasketches-cpp/kll/test/kll_sketch_validation.cpp +1 -1
  40. data/vendor/datasketches-cpp/kll/test/kolmogorov_smirnov_test.cpp +1 -1
  41. data/vendor/datasketches-cpp/pyproject.toml +0 -1
  42. data/vendor/datasketches-cpp/python/README.md +6 -9
  43. data/vendor/datasketches-cpp/python/pybind11Path.cmd +1 -1
  44. data/vendor/datasketches-cpp/quantiles/include/quantiles_sketch.hpp +15 -0
  45. data/vendor/datasketches-cpp/quantiles/include/quantiles_sketch_impl.hpp +78 -14
  46. data/vendor/datasketches-cpp/quantiles/test/kolmogorov_smirnov_test.cpp +3 -3
  47. data/vendor/datasketches-cpp/quantiles/test/quantiles_compatibility_test.cpp +1 -1
  48. data/vendor/datasketches-cpp/quantiles/test/quantiles_sketch_test.cpp +64 -1
  49. data/vendor/datasketches-cpp/req/include/req_compactor.hpp +6 -0
  50. data/vendor/datasketches-cpp/req/include/req_compactor_impl.hpp +27 -0
  51. data/vendor/datasketches-cpp/req/include/req_sketch.hpp +11 -0
  52. data/vendor/datasketches-cpp/req/include/req_sketch_impl.hpp +29 -2
  53. data/vendor/datasketches-cpp/req/test/req_sketch_custom_type_test.cpp +1 -1
  54. data/vendor/datasketches-cpp/req/test/req_sketch_test.cpp +70 -4
  55. data/vendor/datasketches-cpp/sampling/test/var_opt_allocation_test.cpp +1 -1
  56. data/vendor/datasketches-cpp/sampling/test/var_opt_sketch_test.cpp +1 -1
  57. data/vendor/datasketches-cpp/sampling/test/var_opt_union_test.cpp +1 -1
  58. data/vendor/datasketches-cpp/setup.py +2 -3
  59. data/vendor/datasketches-cpp/theta/test/theta_a_not_b_test.cpp +1 -1
  60. data/vendor/datasketches-cpp/theta/test/theta_intersection_test.cpp +1 -1
  61. data/vendor/datasketches-cpp/theta/test/theta_jaccard_similarity_test.cpp +1 -1
  62. data/vendor/datasketches-cpp/theta/test/theta_setop_test.cpp +1 -1
  63. data/vendor/datasketches-cpp/theta/test/theta_sketch_test.cpp +1 -1
  64. data/vendor/datasketches-cpp/theta/test/theta_union_test.cpp +1 -1
  65. data/vendor/datasketches-cpp/tuple/include/tuple_sketch_impl.hpp +25 -31
  66. data/vendor/datasketches-cpp/tuple/test/array_of_doubles_sketch_test.cpp +1 -1
  67. data/vendor/datasketches-cpp/tuple/test/tuple_a_not_b_test.cpp +1 -1
  68. data/vendor/datasketches-cpp/tuple/test/tuple_intersection_test.cpp +1 -1
  69. data/vendor/datasketches-cpp/tuple/test/tuple_jaccard_similarity_test.cpp +1 -1
  70. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_allocation_test.cpp +1 -1
  71. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_test.cpp +1 -1
  72. data/vendor/datasketches-cpp/tuple/test/tuple_union_test.cpp +1 -1
  73. metadata +2 -4
  74. data/vendor/datasketches-cpp/common/test/catch.hpp +0 -17618
  75. data/vendor/datasketches-cpp/common/test/test_runner.cpp +0 -29
@@ -132,6 +132,33 @@ req_compactor<T, C, A>& req_compactor<T, C, A>::operator=(req_compactor&& other)
132
132
  return *this;
133
133
  }
134
134
 
135
+ template<typename T, typename C, typename A>
136
+ template<typename TT, typename CC, typename AA>
137
+ req_compactor<T, C, A>::req_compactor(const req_compactor<TT, CC, AA>& other, const A& allocator):
138
+ allocator_(allocator),
139
+ lg_weight_(other.lg_weight_),
140
+ hra_(other.hra_),
141
+ coin_(other.coin_),
142
+ sorted_(other.sorted_),
143
+ section_size_raw_(other.section_size_raw_),
144
+ section_size_(other.section_size_),
145
+ num_sections_(other.num_sections_),
146
+ state_(other.state_),
147
+ num_items_(other.num_items_),
148
+ capacity_(other.capacity_),
149
+ items_(nullptr)
150
+ {
151
+ if (other.items_ != nullptr) {
152
+ items_ = allocator_.allocate(capacity_);
153
+ const uint32_t from = hra_ ? capacity_ - num_items_ : 0;
154
+ const uint32_t to = hra_ ? capacity_ : num_items_;
155
+ for (uint32_t i = from; i < to; ++i) new (items_ + i) T(other.items_[i]);
156
+ if (sorted_ && !std::is_sorted(items_ + from, items_ + to, C())) {
157
+ throw std::logic_error("items must be sorted");
158
+ }
159
+ }
160
+ }
161
+
135
162
  template<typename T, typename C, typename A>
136
163
  bool req_compactor<T, C, A>::is_sorted() const {
137
164
  return sorted_;
@@ -58,6 +58,14 @@ public:
58
58
  req_sketch& operator=(const req_sketch& other);
59
59
  req_sketch& operator=(req_sketch&& other);
60
60
 
61
+ /*
62
+ * Type converting constructor.
63
+ * @param other sketch of a different type
64
+ * @param allocator instance of an Allocator
65
+ */
66
+ template<typename TT, typename CC, typename SS, typename AA>
67
+ explicit req_sketch(const req_sketch<TT, CC, SS, AA>& other, const Allocator& allocator = Allocator());
68
+
61
69
  /**
62
70
  * Returns configured parameter K
63
71
  * @return parameter K
@@ -408,6 +416,9 @@ private:
408
416
  }
409
417
  }
410
418
 
419
+ // for type converting constructor
420
+ template<typename TT, typename CC, typename SS, typename AA>
421
+ friend class req_sketch;
411
422
  };
412
423
 
413
424
  template<typename T, typename C, typename S, typename A>
@@ -64,8 +64,8 @@ compactors_(other.compactors_),
64
64
  min_value_(nullptr),
65
65
  max_value_(nullptr)
66
66
  {
67
- if (other.min_value_ != nullptr) min_value_ = new (A().allocate(1)) T(*other.min_value_);
68
- if (other.max_value_ != nullptr) max_value_ = new (A().allocate(1)) T(*other.max_value_);
67
+ if (other.min_value_ != nullptr) min_value_ = new (allocator_.allocate(1)) T(*other.min_value_);
68
+ if (other.max_value_ != nullptr) max_value_ = new (allocator_.allocate(1)) T(*other.max_value_);
69
69
  }
70
70
 
71
71
  template<typename T, typename C, typename S, typename A>
@@ -113,6 +113,33 @@ req_sketch<T, C, S, A>& req_sketch<T, C, S, A>::operator=(req_sketch&& other) {
113
113
  return *this;
114
114
  }
115
115
 
116
+ template<typename T, typename C, typename S, typename A>
117
+ template<typename TT, typename CC, typename SS, typename AA>
118
+ req_sketch<T, C, S, A>::req_sketch(const req_sketch<TT, CC, SS, AA>& other, const A& allocator):
119
+ allocator_(allocator),
120
+ k_(other.k_),
121
+ hra_(other.hra_),
122
+ max_nom_size_(other.max_nom_size_),
123
+ num_retained_(other.num_retained_),
124
+ n_(other.n_),
125
+ compactors_(allocator),
126
+ min_value_(nullptr),
127
+ max_value_(nullptr)
128
+ {
129
+ static_assert(
130
+ std::is_constructible<T, TT>::value,
131
+ "Type converting constructor requires new type to be constructible from existing type"
132
+ );
133
+ compactors_.reserve(other.compactors_.size());
134
+ for (const auto& compactor: other.compactors_) {
135
+ compactors_.push_back(req_compactor<T, C, A>(compactor, allocator_));
136
+ }
137
+ if (!other.is_empty()) {
138
+ min_value_ = new (allocator_.allocate(1)) T(other.get_min_value());
139
+ max_value_ = new (allocator_.allocate(1)) T(other.get_max_value());
140
+ }
141
+ }
142
+
116
143
  template<typename T, typename C, typename S, typename A>
117
144
  uint16_t req_sketch<T, C, S, A>::get_k() const {
118
145
  return k_;
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #include <catch.hpp>
20
+ #include <catch2/catch.hpp>
21
21
  #include <sstream>
22
22
 
23
23
  #include <req_sketch.hpp>
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #include <catch.hpp>
20
+ #include <catch2/catch.hpp>
21
21
 
22
22
  #include <req_sketch.hpp>
23
23
 
@@ -35,7 +35,7 @@ const std::string input_path = "test/";
35
35
  #endif
36
36
 
37
37
  TEST_CASE("req sketch: empty", "[req_sketch]") {
38
- std::cout << "sizeof(req_float_sketch)=" << sizeof(req_sketch<float>) << "\n";
38
+ //std::cout << "sizeof(req_float_sketch)=" << sizeof(req_sketch<float>) << "\n";
39
39
  req_sketch<float> sketch(12);
40
40
  REQUIRE(sketch.get_k() == 12);
41
41
  REQUIRE(sketch.is_HRA());
@@ -245,7 +245,7 @@ TEST_CASE("req sketch: byte serialize-deserialize single item", "[req_sketch]")
245
245
  auto bytes = sketch.serialize();
246
246
  REQUIRE(bytes.size() == sketch.get_serialized_size_bytes());
247
247
  auto sketch2 = req_sketch<float>::deserialize(bytes.data(), bytes.size());
248
- std::cout << sketch2.to_string(true);
248
+ //std::cout << sketch2.to_string(true);
249
249
  REQUIRE(bytes.size() == sketch2.get_serialized_size_bytes());
250
250
  REQUIRE(sketch2.is_empty() == sketch.is_empty());
251
251
  REQUIRE(sketch2.is_estimation_mode() == sketch.is_estimation_mode());
@@ -282,7 +282,7 @@ TEST_CASE("req sketch: byte serialize-deserialize exact mode", "[req_sketch]") {
282
282
  auto bytes = sketch.serialize();
283
283
  REQUIRE(bytes.size() == sketch.get_serialized_size_bytes());
284
284
  auto sketch2 = req_sketch<float>::deserialize(bytes.data(), bytes.size());
285
- std::cout << sketch2.to_string(true);
285
+ //std::cout << sketch2.to_string(true);
286
286
  REQUIRE(bytes.size() == sketch2.get_serialized_size_bytes());
287
287
  REQUIRE(sketch2.is_empty() == sketch.is_empty());
288
288
  REQUIRE(sketch2.is_estimation_mode() == sketch.is_estimation_mode());
@@ -485,6 +485,72 @@ TEST_CASE("req sketch: merge incompatible HRA and LRA", "[req_sketch]") {
485
485
  REQUIRE_THROWS_AS(sketch1.merge(sketch2), std::invalid_argument);
486
486
  }
487
487
 
488
+ TEST_CASE("req sketch: type conversion - empty", "[req_sketch]") {
489
+ req_sketch<double> req_double(12);
490
+ req_sketch<float> req_float(req_double);
491
+ REQUIRE(req_float.is_empty());
492
+ REQUIRE(req_float.get_k() == req_double.get_k());
493
+ REQUIRE(req_float.get_n() == 0);
494
+ REQUIRE(req_float.get_num_retained() == 0);
495
+ }
496
+
497
+ TEST_CASE("req sketch: type conversion - several levels", "[req_sketch]") {
498
+ req_sketch<double> req_double(12);
499
+ for (int i = 0; i < 1000; ++i) req_double.update(static_cast<double>(i));
500
+ req_sketch<float> req_float(req_double);
501
+ REQUIRE(!req_float.is_empty());
502
+ REQUIRE(req_float.get_k() == req_double.get_k());
503
+ REQUIRE(req_float.get_n() == req_double.get_n());
504
+ REQUIRE(req_float.get_num_retained() == req_double.get_num_retained());
505
+
506
+ auto sv_float = req_float.get_sorted_view(false);
507
+ auto sv_double = req_double.get_sorted_view(false);
508
+ auto sv_float_it = sv_float.begin();
509
+ auto sv_double_it = sv_double.begin();
510
+ while (sv_float_it != sv_float.end()) {
511
+ REQUIRE(sv_double_it != sv_double.end());
512
+ auto float_pair = *sv_float_it;
513
+ auto double_pair = *sv_double_it;
514
+ REQUIRE(float_pair.first == Approx(double_pair.first).margin(0.01));
515
+ REQUIRE(float_pair.second == double_pair.second);
516
+ ++sv_float_it;
517
+ ++sv_double_it;
518
+ }
519
+ REQUIRE(sv_double_it == sv_double.end());
520
+ }
521
+
522
+ class A {
523
+ int val;
524
+ public:
525
+ A(int val): val(val) {}
526
+ int get_val() const { return val; }
527
+ };
528
+
529
+ struct less_A {
530
+ bool operator()(const A& a1, const A& a2) const { return a1.get_val() < a2.get_val(); }
531
+ };
532
+
533
+ class B {
534
+ int val;
535
+ public:
536
+ explicit B(const A& a): val(a.get_val()) {}
537
+ int get_val() const { return val; }
538
+ };
539
+
540
+ struct less_B {
541
+ bool operator()(const B& b1, const B& b2) const { return b1.get_val() < b2.get_val(); }
542
+ };
543
+
544
+ TEST_CASE("req sketch: type conversion - custom types") {
545
+ req_sketch<A, less_A> sa(4);
546
+ sa.update(1);
547
+ sa.update(2);
548
+ sa.update(3);
549
+
550
+ req_sketch<B, less_B> sb(sa);
551
+ REQUIRE(sb.get_n() == 3);
552
+ }
553
+
488
554
  //TEST_CASE("for manual comparison with Java") {
489
555
  // req_sketch<float> sketch(12, false);
490
556
  // for (size_t i = 0; i < 100000; ++i) sketch.update(i);
@@ -22,7 +22,7 @@
22
22
  #include <test_type.hpp>
23
23
  #include <test_allocator.hpp>
24
24
 
25
- #include <catch.hpp>
25
+ #include <catch2/catch.hpp>
26
26
 
27
27
  #include <sstream>
28
28
 
@@ -19,7 +19,7 @@
19
19
 
20
20
  #include <var_opt_sketch.hpp>
21
21
 
22
- #include <catch.hpp>
22
+ #include <catch2/catch.hpp>
23
23
 
24
24
  #include <vector>
25
25
  #include <string>
@@ -19,7 +19,7 @@
19
19
 
20
20
  #include <var_opt_union.hpp>
21
21
 
22
- #include <catch.hpp>
22
+ #include <catch2/catch.hpp>
23
23
 
24
24
  #include <vector>
25
25
  #include <string>
@@ -20,7 +20,6 @@
20
20
 
21
21
  import os
22
22
  import sys
23
- import sysconfig
24
23
  import platform
25
24
  import subprocess
26
25
 
@@ -81,7 +80,7 @@ class CMakeBuild(build_ext):
81
80
 
82
81
  setup(
83
82
  name='datasketches',
84
- version='3.4.0',
83
+ version='3.5.1',
85
84
  author='Apache Software Foundation',
86
85
  author_email='dev@datasketches.apache.org',
87
86
  description='The Apache DataSketches Library for Python',
@@ -89,7 +88,7 @@ setup(
89
88
  url='http://datasketches.apache.org',
90
89
  long_description=open('python/README.md').read(),
91
90
  long_description_content_type='text/markdown',
92
- packages=find_packages('python'), # python pacakges only in this dir
91
+ packages=find_packages(where='python',exclude=['src','*tests*']), # src not needed if only the.so
93
92
  package_dir={'':'python'},
94
93
  # may need to add all source paths for sdist packages w/o MANIFEST.in
95
94
  ext_modules=[CMakeExtension('datasketches')],
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #include <catch.hpp>
20
+ #include <catch2/catch.hpp>
21
21
 
22
22
  #include <theta_a_not_b.hpp>
23
23
 
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #include <catch.hpp>
20
+ #include <catch2/catch.hpp>
21
21
 
22
22
  #include <theta_intersection.hpp>
23
23
 
@@ -19,7 +19,7 @@
19
19
 
20
20
  #include <iostream>
21
21
 
22
- #include <catch.hpp>
22
+ #include <catch2/catch.hpp>
23
23
 
24
24
  #include "theta_jaccard_similarity.hpp"
25
25
 
@@ -20,7 +20,7 @@
20
20
  #include <sstream>
21
21
  #include <stdexcept>
22
22
 
23
- #include <catch.hpp>
23
+ #include <catch2/catch.hpp>
24
24
  #include <theta_union.hpp>
25
25
  #include <theta_intersection.hpp>
26
26
  #include <theta_a_not_b.hpp>
@@ -23,7 +23,7 @@
23
23
  #include <vector>
24
24
  #include <stdexcept>
25
25
 
26
- #include <catch.hpp>
26
+ #include <catch2/catch.hpp>
27
27
  #include <theta_sketch.hpp>
28
28
 
29
29
  namespace datasketches {
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- #include <catch.hpp>
20
+ #include <catch2/catch.hpp>
21
21
 
22
22
  #include <theta_union.hpp>
23
23
 
@@ -353,8 +353,7 @@ size_t compact_tuple_sketch<S, A>::get_serialized_size_summaries_bytes(const SD&
353
353
  template<typename S, typename A>
354
354
  template<typename SerDe>
355
355
  void compact_tuple_sketch<S, A>::serialize(std::ostream& os, const SerDe& sd) const {
356
- const bool is_single_item = entries_.size() == 1 && !this->is_estimation_mode();
357
- const uint8_t preamble_longs = this->is_empty() || is_single_item ? 1 : this->is_estimation_mode() ? 3 : 2;
356
+ const uint8_t preamble_longs = this->is_estimation_mode() ? 3 : this->is_empty() || entries_.size() == 1 ? 1 : 2;
358
357
  write(os, preamble_longs);
359
358
  const uint8_t serial_version = SERIAL_VERSION;
360
359
  write(os, serial_version);
@@ -373,28 +372,25 @@ void compact_tuple_sketch<S, A>::serialize(std::ostream& os, const SerDe& sd) co
373
372
  write(os, flags_byte);
374
373
  const uint16_t seed_hash = get_seed_hash();
375
374
  write(os, seed_hash);
376
- if (!this->is_empty()) {
377
- if (!is_single_item) {
378
- const uint32_t num_entries = static_cast<uint32_t>(entries_.size());
379
- write(os, num_entries);
380
- const uint32_t unused32 = 0;
381
- write(os, unused32);
382
- if (this->is_estimation_mode()) {
383
- write(os, this->theta_);
384
- }
385
- }
386
- for (const auto& it: entries_) {
387
- write(os, it.first);
388
- sd.serialize(os, &it.second, 1);
389
- }
375
+ if (preamble_longs > 1) {
376
+ const uint32_t num_entries = static_cast<uint32_t>(entries_.size());
377
+ write(os, num_entries);
378
+ const uint32_t unused32 = 0;
379
+ write(os, unused32);
380
+ }
381
+ if (this->is_estimation_mode()) {
382
+ write(os, this->theta_);
383
+ }
384
+ for (const auto& it: entries_) {
385
+ write(os, it.first);
386
+ sd.serialize(os, &it.second, 1);
390
387
  }
391
388
  }
392
389
 
393
390
  template<typename S, typename A>
394
391
  template<typename SerDe>
395
392
  auto compact_tuple_sketch<S, A>::serialize(unsigned header_size_bytes, const SerDe& sd) const -> vector_bytes {
396
- const bool is_single_item = entries_.size() == 1 && !this->is_estimation_mode();
397
- const uint8_t preamble_longs = this->is_empty() || is_single_item ? 1 : this->is_estimation_mode() ? 3 : 2;
393
+ const uint8_t preamble_longs = this->is_estimation_mode() ? 3 : this->is_empty() || entries_.size() == 1 ? 1 : 2;
398
394
  const size_t size = header_size_bytes + sizeof(uint64_t) * preamble_longs
399
395
  + sizeof(uint64_t) * entries_.size() + get_serialized_size_summaries_bytes(sd);
400
396
  vector_bytes bytes(size, 0, entries_.get_allocator());
@@ -418,19 +414,17 @@ auto compact_tuple_sketch<S, A>::serialize(unsigned header_size_bytes, const Ser
418
414
  ptr += copy_to_mem(flags_byte, ptr);
419
415
  const uint16_t seed_hash = get_seed_hash();
420
416
  ptr += copy_to_mem(seed_hash, ptr);
421
- if (!this->is_empty()) {
422
- if (!is_single_item) {
423
- const uint32_t num_entries = static_cast<uint32_t>(entries_.size());
424
- ptr += copy_to_mem(num_entries, ptr);
425
- ptr += sizeof(uint32_t); // unused
426
- if (this->is_estimation_mode()) {
427
- ptr += copy_to_mem(theta_, ptr);
428
- }
429
- }
430
- for (const auto& it: entries_) {
431
- ptr += copy_to_mem(it.first, ptr);
432
- ptr += sd.serialize(ptr, end_ptr - ptr, &it.second, 1);
433
- }
417
+ if (preamble_longs > 1) {
418
+ const uint32_t num_entries = static_cast<uint32_t>(entries_.size());
419
+ ptr += copy_to_mem(num_entries, ptr);
420
+ ptr += sizeof(uint32_t); // unused
421
+ }
422
+ if (this->is_estimation_mode()) {
423
+ ptr += copy_to_mem(theta_, ptr);
424
+ }
425
+ for (const auto& it: entries_) {
426
+ ptr += copy_to_mem(it.first, ptr);
427
+ ptr += sd.serialize(ptr, end_ptr - ptr, &it.second, 1);
434
428
  }
435
429
  return bytes;
436
430
  }
@@ -22,7 +22,7 @@
22
22
  #include <sstream>
23
23
  #include <array>
24
24
 
25
- #include <catch.hpp>
25
+ #include <catch2/catch.hpp>
26
26
  #include <array_of_doubles_sketch.hpp>
27
27
  #include <array_of_doubles_union.hpp>
28
28
  #include <array_of_doubles_intersection.hpp>
@@ -19,7 +19,7 @@
19
19
 
20
20
  #include <iostream>
21
21
 
22
- #include <catch.hpp>
22
+ #include <catch2/catch.hpp>
23
23
  #include <tuple_a_not_b.hpp>
24
24
  #include <theta_sketch.hpp>
25
25
  #include <stdexcept>
@@ -19,7 +19,7 @@
19
19
 
20
20
  #include <iostream>
21
21
 
22
- #include <catch.hpp>
22
+ #include <catch2/catch.hpp>
23
23
  #include <tuple_intersection.hpp>
24
24
  #include <theta_sketch.hpp>
25
25
  #include <stdexcept>
@@ -19,7 +19,7 @@
19
19
 
20
20
  #include <iostream>
21
21
 
22
- #include <catch.hpp>
22
+ #include <catch2/catch.hpp>
23
23
 
24
24
  #include "tuple_jaccard_similarity.hpp"
25
25
 
@@ -19,7 +19,7 @@
19
19
 
20
20
  #include <iostream>
21
21
 
22
- #include <catch.hpp>
22
+ #include <catch2/catch.hpp>
23
23
  #include <tuple_sketch.hpp>
24
24
  #include <test_allocator.hpp>
25
25
  #include <test_type.hpp>
@@ -32,7 +32,7 @@ std::ostream& operator<<(std::ostream& os, const three_doubles& tuple) {
32
32
 
33
33
  }
34
34
 
35
- #include <catch.hpp>
35
+ #include <catch2/catch.hpp>
36
36
  #include <tuple_sketch.hpp>
37
37
 
38
38
  namespace datasketches {
@@ -20,7 +20,7 @@
20
20
  #include <iostream>
21
21
  #include <stdexcept>
22
22
 
23
- #include <catch.hpp>
23
+ #include <catch2/catch.hpp>
24
24
  #include <tuple_union.hpp>
25
25
  #include <theta_sketch.hpp>
26
26
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datasketches
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-21 00:00:00.000000000 Z
11
+ date: 2022-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rice
@@ -69,12 +69,10 @@ files:
69
69
  - vendor/datasketches-cpp/common/include/quantile_sketch_sorted_view_impl.hpp
70
70
  - vendor/datasketches-cpp/common/include/serde.hpp
71
71
  - vendor/datasketches-cpp/common/test/CMakeLists.txt
72
- - vendor/datasketches-cpp/common/test/catch.hpp
73
72
  - vendor/datasketches-cpp/common/test/catch_runner.cpp
74
73
  - vendor/datasketches-cpp/common/test/integration_test.cpp
75
74
  - vendor/datasketches-cpp/common/test/test_allocator.cpp
76
75
  - vendor/datasketches-cpp/common/test/test_allocator.hpp
77
- - vendor/datasketches-cpp/common/test/test_runner.cpp
78
76
  - vendor/datasketches-cpp/common/test/test_type.hpp
79
77
  - vendor/datasketches-cpp/cpc/CMakeLists.txt
80
78
  - vendor/datasketches-cpp/cpc/include/compression_data.hpp