datasketches 0.2.6 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/LICENSE +4 -6
  4. data/NOTICE +6 -5
  5. data/ext/datasketches/kll_wrapper.cpp +20 -20
  6. data/ext/datasketches/theta_wrapper.cpp +2 -2
  7. data/lib/datasketches/version.rb +1 -1
  8. data/vendor/datasketches-cpp/CMakeLists.txt +9 -1
  9. data/vendor/datasketches-cpp/LICENSE +4 -6
  10. data/vendor/datasketches-cpp/MANIFEST.in +21 -4
  11. data/vendor/datasketches-cpp/common/CMakeLists.txt +5 -2
  12. data/vendor/datasketches-cpp/common/include/common_defs.hpp +10 -0
  13. data/vendor/datasketches-cpp/common/include/kolmogorov_smirnov_impl.hpp +6 -6
  14. data/vendor/datasketches-cpp/common/include/memory_operations.hpp +1 -0
  15. data/vendor/datasketches-cpp/common/include/{quantile_sketch_sorted_view.hpp → quantiles_sorted_view.hpp} +60 -25
  16. data/vendor/datasketches-cpp/common/include/quantiles_sorted_view_impl.hpp +125 -0
  17. data/vendor/datasketches-cpp/common/{test/test_runner.cpp → include/version.hpp.in} +15 -8
  18. data/vendor/datasketches-cpp/common/test/CMakeLists.txt +37 -7
  19. data/vendor/datasketches-cpp/common/test/catch_runner.cpp +22 -1
  20. data/vendor/datasketches-cpp/common/test/integration_test.cpp +1 -1
  21. data/vendor/datasketches-cpp/common/test/quantiles_sorted_view_test.cpp +459 -0
  22. data/vendor/datasketches-cpp/cpc/test/CMakeLists.txt +1 -1
  23. data/vendor/datasketches-cpp/cpc/test/compression_test.cpp +1 -1
  24. data/vendor/datasketches-cpp/cpc/test/cpc_sketch_allocation_test.cpp +1 -1
  25. data/vendor/datasketches-cpp/cpc/test/cpc_sketch_test.cpp +1 -1
  26. data/vendor/datasketches-cpp/cpc/test/cpc_union_test.cpp +1 -1
  27. data/vendor/datasketches-cpp/fi/include/frequent_items_sketch.hpp +28 -44
  28. data/vendor/datasketches-cpp/fi/include/frequent_items_sketch_impl.hpp +70 -78
  29. data/vendor/datasketches-cpp/fi/include/reverse_purge_hash_map.hpp +11 -4
  30. data/vendor/datasketches-cpp/fi/include/reverse_purge_hash_map_impl.hpp +17 -10
  31. data/vendor/datasketches-cpp/fi/test/CMakeLists.txt +1 -1
  32. data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_custom_type_test.cpp +55 -42
  33. data/vendor/datasketches-cpp/fi/test/frequent_items_sketch_test.cpp +1 -1
  34. data/vendor/datasketches-cpp/fi/test/reverse_purge_hash_map_test.cpp +4 -4
  35. data/vendor/datasketches-cpp/hll/include/Hll4Array-internal.hpp +2 -2
  36. data/vendor/datasketches-cpp/hll/test/AuxHashMapTest.cpp +1 -1
  37. data/vendor/datasketches-cpp/hll/test/CMakeLists.txt +1 -1
  38. data/vendor/datasketches-cpp/hll/test/CouponHashSetTest.cpp +1 -1
  39. data/vendor/datasketches-cpp/hll/test/CouponListTest.cpp +1 -1
  40. data/vendor/datasketches-cpp/hll/test/CrossCountingTest.cpp +1 -1
  41. data/vendor/datasketches-cpp/hll/test/HllArrayTest.cpp +1 -1
  42. data/vendor/datasketches-cpp/hll/test/HllSketchTest.cpp +1 -1
  43. data/vendor/datasketches-cpp/hll/test/HllUnionTest.cpp +1 -1
  44. data/vendor/datasketches-cpp/hll/test/IsomorphicTest.cpp +1 -1
  45. data/vendor/datasketches-cpp/hll/test/TablesTest.cpp +1 -1
  46. data/vendor/datasketches-cpp/hll/test/ToFromByteArrayTest.cpp +1 -1
  47. data/vendor/datasketches-cpp/kll/include/kll_helper.hpp +0 -32
  48. data/vendor/datasketches-cpp/kll/include/kll_sketch.hpp +176 -233
  49. data/vendor/datasketches-cpp/kll/include/kll_sketch_impl.hpp +337 -395
  50. data/vendor/datasketches-cpp/kll/test/CMakeLists.txt +1 -1
  51. data/vendor/datasketches-cpp/kll/test/kll_sketch_custom_type_test.cpp +27 -27
  52. data/vendor/datasketches-cpp/kll/test/kll_sketch_test.cpp +197 -233
  53. data/vendor/datasketches-cpp/kll/test/kll_sketch_validation.cpp +42 -32
  54. data/vendor/datasketches-cpp/kll/test/kolmogorov_smirnov_test.cpp +1 -1
  55. data/vendor/datasketches-cpp/pyproject.toml +17 -13
  56. data/vendor/datasketches-cpp/python/CMakeLists.txt +8 -1
  57. data/vendor/datasketches-cpp/python/README.md +1 -1
  58. data/vendor/datasketches-cpp/python/datasketches/PySerDe.py +104 -0
  59. data/vendor/datasketches-cpp/python/datasketches/__init__.py +22 -0
  60. data/vendor/datasketches-cpp/python/include/py_serde.hpp +113 -0
  61. data/vendor/datasketches-cpp/python/jupyter/ThetaSketchNotebook.ipynb +31 -24
  62. data/vendor/datasketches-cpp/python/pybind11Path.cmd +19 -1
  63. data/vendor/datasketches-cpp/python/src/__init__.py +17 -1
  64. data/vendor/datasketches-cpp/python/src/datasketches.cpp +9 -3
  65. data/vendor/datasketches-cpp/python/src/kll_wrapper.cpp +18 -54
  66. data/vendor/datasketches-cpp/python/src/py_serde.cpp +111 -0
  67. data/vendor/datasketches-cpp/python/src/quantiles_wrapper.cpp +17 -53
  68. data/vendor/datasketches-cpp/python/src/req_wrapper.cpp +17 -55
  69. data/vendor/datasketches-cpp/python/src/vector_of_kll.cpp +62 -67
  70. data/vendor/datasketches-cpp/python/src/vo_wrapper.cpp +47 -14
  71. data/vendor/datasketches-cpp/python/tests/__init__.py +16 -0
  72. data/vendor/datasketches-cpp/python/tests/req_test.py +1 -1
  73. data/vendor/datasketches-cpp/python/tests/vo_test.py +25 -1
  74. data/vendor/datasketches-cpp/quantiles/include/quantiles_sketch.hpp +135 -180
  75. data/vendor/datasketches-cpp/quantiles/include/quantiles_sketch_impl.hpp +205 -210
  76. data/vendor/datasketches-cpp/quantiles/test/CMakeLists.txt +1 -1
  77. data/vendor/datasketches-cpp/quantiles/test/kolmogorov_smirnov_test.cpp +1 -1
  78. data/vendor/datasketches-cpp/quantiles/test/quantiles_compatibility_test.cpp +20 -19
  79. data/vendor/datasketches-cpp/quantiles/test/quantiles_sketch_test.cpp +241 -233
  80. data/vendor/datasketches-cpp/req/include/req_compactor.hpp +15 -9
  81. data/vendor/datasketches-cpp/req/include/req_compactor_impl.hpp +35 -19
  82. data/vendor/datasketches-cpp/req/include/req_sketch.hpp +126 -147
  83. data/vendor/datasketches-cpp/req/include/req_sketch_impl.hpp +265 -245
  84. data/vendor/datasketches-cpp/req/test/CMakeLists.txt +1 -1
  85. data/vendor/datasketches-cpp/req/test/req_sketch_custom_type_test.cpp +27 -27
  86. data/vendor/datasketches-cpp/req/test/req_sketch_test.cpp +117 -104
  87. data/vendor/datasketches-cpp/sampling/include/var_opt_sketch.hpp +22 -46
  88. data/vendor/datasketches-cpp/sampling/include/var_opt_sketch_impl.hpp +180 -207
  89. data/vendor/datasketches-cpp/sampling/include/var_opt_union.hpp +18 -39
  90. data/vendor/datasketches-cpp/sampling/include/var_opt_union_impl.hpp +75 -85
  91. data/vendor/datasketches-cpp/sampling/test/CMakeLists.txt +1 -1
  92. data/vendor/datasketches-cpp/sampling/test/var_opt_allocation_test.cpp +7 -7
  93. data/vendor/datasketches-cpp/sampling/test/var_opt_sketch_test.cpp +3 -3
  94. data/vendor/datasketches-cpp/sampling/test/var_opt_union_test.cpp +5 -5
  95. data/vendor/datasketches-cpp/setup.py +14 -3
  96. data/vendor/datasketches-cpp/theta/include/theta_sketch_impl.hpp +15 -25
  97. data/vendor/datasketches-cpp/theta/include/theta_update_sketch_base.hpp +0 -9
  98. data/vendor/datasketches-cpp/theta/include/theta_update_sketch_base_impl.hpp +5 -5
  99. data/vendor/datasketches-cpp/theta/test/CMakeLists.txt +1 -1
  100. data/vendor/datasketches-cpp/theta/test/theta_a_not_b_test.cpp +1 -1
  101. data/vendor/datasketches-cpp/theta/test/theta_intersection_test.cpp +1 -1
  102. data/vendor/datasketches-cpp/theta/test/theta_jaccard_similarity_test.cpp +1 -1
  103. data/vendor/datasketches-cpp/theta/test/theta_setop_test.cpp +1 -1
  104. data/vendor/datasketches-cpp/theta/test/theta_sketch_test.cpp +3 -2
  105. data/vendor/datasketches-cpp/theta/test/theta_union_test.cpp +1 -1
  106. data/vendor/datasketches-cpp/tox.ini +26 -0
  107. data/vendor/datasketches-cpp/tuple/include/tuple_sketch.hpp +36 -12
  108. data/vendor/datasketches-cpp/tuple/include/tuple_sketch_impl.hpp +41 -35
  109. data/vendor/datasketches-cpp/tuple/test/CMakeLists.txt +2 -1
  110. data/vendor/datasketches-cpp/tuple/test/array_of_doubles_sketch_test.cpp +1 -1
  111. data/vendor/datasketches-cpp/tuple/test/engagement_test.cpp +299 -0
  112. data/vendor/datasketches-cpp/tuple/test/tuple_a_not_b_test.cpp +1 -1
  113. data/vendor/datasketches-cpp/tuple/test/tuple_intersection_test.cpp +1 -1
  114. data/vendor/datasketches-cpp/tuple/test/tuple_jaccard_similarity_test.cpp +1 -1
  115. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_allocation_test.cpp +1 -1
  116. data/vendor/datasketches-cpp/tuple/test/tuple_sketch_test.cpp +27 -1
  117. data/vendor/datasketches-cpp/tuple/test/tuple_union_test.cpp +1 -1
  118. data/vendor/datasketches-cpp/version.cfg.in +1 -0
  119. metadata +14 -7
  120. data/vendor/datasketches-cpp/common/include/quantile_sketch_sorted_view_impl.hpp +0 -91
  121. data/vendor/datasketches-cpp/common/test/catch.hpp +0 -17618
@@ -17,7 +17,7 @@
17
17
 
18
18
  add_executable(quantiles_test)
19
19
 
20
- target_link_libraries(quantiles_test quantiles common common_test)
20
+ target_link_libraries(quantiles_test quantiles common common_test_lib)
21
21
 
22
22
  set_target_properties(quantiles_test PROPERTIES
23
23
  CXX_STANDARD 11
@@ -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 <random>
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
  #include <cmath>
22
22
  #include <sstream>
23
23
  #include <fstream>
@@ -52,7 +52,7 @@ static void quantiles_decode_and_check(uint16_t k, uint64_t n, const std::string
52
52
  std::string filename = testBinaryInputPath + filestr.str();
53
53
 
54
54
  is.open(filename, std::ios::binary);
55
- auto sketch_stream = quantiles_double_sketch::deserialize(is, serde<double>(), 0);
55
+ auto sketch_stream = quantiles_double_sketch::deserialize(is, serde<double>(), std::less<double>(), 0);
56
56
  is.close();
57
57
  REQUIRE(sketch_stream.get_quantile(median_rank) == expected_median);
58
58
 
@@ -62,7 +62,8 @@ static void quantiles_decode_and_check(uint16_t k, uint64_t n, const std::string
62
62
  (std::istreambuf_iterator<char>(infile)),
63
63
  (std::istreambuf_iterator<char>()));
64
64
  infile.close();
65
- auto sketch_bytes = quantiles_double_sketch::deserialize(bytes.data(), bytes.size(), serde<double>(), 0);
65
+ auto sketch_bytes = quantiles_double_sketch::deserialize(bytes.data(), bytes.size(), serde<double>(),
66
+ std::less<double>(), 0);
66
67
  REQUIRE(sketch_bytes.get_quantile(median_rank) == expected_median);
67
68
  }
68
69
 
@@ -73,50 +74,50 @@ TEST_CASE("quantiles compatibility", "[quantiles_compatibility]") {
73
74
 
74
75
  SECTION("Qk128_n50_v0.3.0.sk") {
75
76
  // file: Qk128_n50_v0.3.0.sk
76
- // median: 26.0
77
- quantiles_decode_and_check(128, 50, "0.3.0", 26.0);
77
+ // median: 25
78
+ quantiles_decode_and_check(128, 50, "0.3.0", 25);
78
79
  }
79
80
 
80
81
  SECTION("Qk128_n1000_v0.3.0.sk") {
81
82
  // file: Qk128_n1000_v0.3.0.sk
82
- // median: 501.0
83
- quantiles_decode_and_check(128, 1000, "0.3.0", 501.0);
83
+ // median: ~500
84
+ quantiles_decode_and_check(128, 1000, "0.3.0", 497);
84
85
  }
85
86
 
86
87
  SECTION("Qk128_n50_v0.6.0.sk") {
87
88
  // file: Qk128_n50_v0.6.0.sk
88
- // median: 26.0
89
- quantiles_decode_and_check(128, 50, "0.6.0", 26.0);
89
+ // median: 25
90
+ quantiles_decode_and_check(128, 50, "0.6.0", 25);
90
91
  }
91
92
 
92
93
  SECTION("Qk128_n1000_v0.6.0.sk") {
93
94
  // file: Qk128_n1000_v0.6.0.sk
94
- // median: 501.0
95
- quantiles_decode_and_check(128, 1000, "0.6.0", 501.0);
95
+ // median: ~500
96
+ quantiles_decode_and_check(128, 1000, "0.6.0", 497);
96
97
  }
97
98
 
98
99
  SECTION("Qk128_n50_v0.8.0.sk") {
99
100
  // file: Qk128_n50_v0.8.0.sk
100
- // median: 26.0
101
- quantiles_decode_and_check(128, 50, "0.8.0", 26.0);
101
+ // median: 25
102
+ quantiles_decode_and_check(128, 50, "0.8.0", 25);
102
103
  }
103
104
 
104
105
  SECTION("Qk128_n1000_v0.8.0.sk") {
105
106
  // file: Qk128_n1000_v0.8.0.sk
106
- // median: 501.0
107
- quantiles_decode_and_check(128, 1000, "0.8.0", 501.0);
107
+ // median: ~500
108
+ quantiles_decode_and_check(128, 1000, "0.8.0", 497);
108
109
  }
109
110
 
110
111
  SECTION("Qk128_n50_v0.8.3.sk") {
111
112
  // file: Qk128_n50_v0.8.3.sk
112
- // median: 26.0
113
- quantiles_decode_and_check(128, 50, "0.8.3", 26.0);
113
+ // median: 25
114
+ quantiles_decode_and_check(128, 50, "0.8.3", 25);
114
115
  }
115
116
 
116
117
  SECTION("Qk128_n1000_v0.8.3.sk") {
117
118
  // file: Qk128_n1000_v0.8.3.sk
118
- // median: 501.0
119
- quantiles_decode_and_check(128, 1000, "0.8.3", 501.0);
119
+ // median: ~500
120
+ quantiles_decode_and_check(128, 1000, "0.8.3", 497);
120
121
  }
121
122
 
122
123
  // cleanup