@@ -82,13 +82,14 @@ class SparseSketch {
8282 /* *
8383 * Reallocates the bucket array if necessary to either grow or shrink the dense region
8484 */
85- void reallocate_if_needed ();
85+ void reallocate_if_needed (int delta);
86+ void dense_realloc (size_t new_num_dense_rows);
8687
8788 // This variable lets us know how many Buckets to allocate to make space for the SparseBuckets
8889 // that will be using that space
8990 size_t sparse_data_size = ceil(double (sparse_capacity) * sizeof (SparseBucket) / sizeof (Bucket));
9091
91- void update_sparse (uint16_t pos, vec_t update_idx, vec_hash_t checksum );
92+ void update_sparse (SparseBucket to_add, bool realloc_if_needed = true );
9293 SketchSample sample_sparse (size_t first_col, size_t end_col);
9394
9495 inline Bucket& deterministic_bucket () {
@@ -151,11 +152,12 @@ class SparseSketch {
151152 * @param vector_len Length of the vector we are sketching
152153 * @param seed Random seed of the sketch
153154 * @param binary_in Stream holding serialized sketch object
155+ * @param num_buckets Number of buckets in serialized sketch (dense + sparse_capacity)
154156 * @param num_samples [Optional] Number of samples this sketch supports (default = 1)
155157 * @param cols_per_sample [Optional] Number of sketch columns for each sample (default = 1)
156158 */
157- SparseSketch (vec_t vector_len, uint64_t seed, std::istream& binary_in, size_t num_samples = 1 ,
158- size_t cols_per_sample = default_cols_per_sample);
159+ SparseSketch (vec_t vector_len, uint64_t seed, std::istream& binary_in, size_t num_buckets ,
160+ size_t num_samples = 1 , size_t cols_per_sample = default_cols_per_sample);
159161
160162 /* *
161163 * SparseSketch copy constructor
@@ -206,9 +208,10 @@ class SparseSketch {
206208 * Perform an in-place merge function without another Sketch and instead
207209 * use a raw bucket memory.
208210 * We also allow for only a portion of the buckets to be merge at once
209- * @param raw_bucket Raw bucket data to merge into this sketch
211+ * @param raw_bucket Raw bucket data to merge into this sketch
212+ * @param n_raw_buckets Size of raw_buckets in number of Bucket data-structures
210213 */
211- void merge_raw_bucket_buffer (const Bucket *raw_buckets);
214+ void merge_raw_bucket_buffer (const Bucket *raw_buckets, size_t n_raw_buckets );
212215
213216 /* *
214217 * Zero out all the buckets of a sketch.
@@ -240,6 +243,7 @@ class SparseSketch {
240243 inline size_t get_columns () const { return num_columns; }
241244 inline size_t get_buckets () const { return num_buckets; }
242245 inline size_t get_num_samples () const { return num_samples; }
246+ inline size_t get_num_dense_rows () const { return num_dense_rows; }
243247
244248 static size_t calc_bkt_per_col (size_t n) { return ceil (log2 (n)) + 1 ; }
245249
0 commit comments