ZENOTME commented on code in PR #100:
URL: https://github.com/apache/datasketches-rust/pull/100#discussion_r2837037456
##########
datasketches/src/theta/hash_table.rs:
##########
@@ -77,34 +83,58 @@ impl ThetaHashTable {
) -> Self {
let lg_max_size = lg_nom_size + 1;
let lg_cur_size = starting_sub_multiple(lg_max_size, MIN_LG_K,
resize_factor.lg_value());
+ Self::from_raw_parts(
+ lg_cur_size,
+ lg_nom_size,
+ resize_factor,
+ sampling_probability,
+ starting_theta_from_sampling_probability(sampling_probability),
+ hash_seed,
+ true,
+ )
+ }
+
+ /// Constructs a table from raw internal state.
+ ///
+ /// # Panics
+ ///
+ /// Panics if `lg_cur_size > lg_nom_size + 1`. (`lg_nom_size + 1 ==
lg_max_size`)
+ pub fn from_raw_parts(
Review Comment:
This function is mainly used in intersection, and the current implementation
is the same as C++. Use the builder pattern, maybe clearer. E.g.
```
//
let hash_table =
ThetaHashTable::builder(lg_nom_size, resize_factor, hash_seed)
.with_sampling_probability(...) // infer the theta from
sampling_probability
.with_log_cur_size(...); // set log_cur_size manually, ensure
log_cur_size is valid. If not set, the log cur size will be inferred from
log_nom_size.
```
cc @tisonkun
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]