Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 19 additions & 25 deletions .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
# specific language governing permissions and limitations
# under the License.

# All configurations could be found here: https://github.com/apache/infrastructure-asfyaml/

github:
description: A software library of stochastic streaming algorithms, a.k.a. sketches.
homepage: https://datasketches.apache.org
ghp_branch: gh-pages
ghp_path: /docs
Comment on lines -21 to -22

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. until we really need it. I guess most of our docs would either go to https://datasketches.apache.org/ or https://docs.rs/datasketches.

labels:
- rust
- algorithms
- datasketches
features:
issues: true
projects: true
Expand All @@ -28,28 +32,19 @@ github:
squash: true
merge: false
rebase: false
# protected_branches:
# main:
# required_status_checks:
# strict means "Require branches to be up to date before merging."
# strict: true

# required_pull_request_reviews:
# dismiss_stale_reviews: false
# required_approving_review_count: 1

# squash or rebase must be allowed in the repo for this setting to be set to true.
# required_linear_history: false

# required_signatures: false

# requires all conversations to be resolved before merging is possible
# required_conversation_resolution: false
del_branch_on_merge: true
protected_branches:
main:
required_status_checks:
contexts:
- Required

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be "the names of checks". But what "the name" is is vague.

I checked my previous work on Apache Pulsar. Hopefully, we can get it right the first time.

required_pull_request_reviews:
required_approving_review_count: 1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would require a committer's pull request to have one more approving review before merging. But it should be fine as long as we have several active committers overseeing this repo.


dependabot_alerts: true
dependabot_updates: false

# Attempt to make the auto-generated github emails more easily readable in email clients.
# Attempt to make the auto-generated GitHub emails more easily readable in email clients.
custom_subjects:
new_pr: "[PR] {title} ({repository})"
close_pr: "Re: [PR] {title} ({repository})"
Expand All @@ -70,10 +65,9 @@ github:
delete_comment_discussion: "Re: [D] {title} ({repository})"

notifications:
commits: commits@datasketches.apache.org
issues: dev@datasketches.apache.org
discussions: dev@datasketches.apache.org
pullrequests_status: dev@datasketches.apache.org
commits: commits@datasketches.apache.org
issues: dev@datasketches.apache.org
discussions: dev@datasketches.apache.org
pullrequests_status: dev@datasketches.apache.org
pullrequests_comment: dev@datasketches.apache.org
# Send dependabot PRs to commits@ instead
pullrequests_bot_dependabot: commits@datasketches.apache.org
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,12 @@ rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
mur3 = { version = "0.1.0" }

[lints.rust]
unknown_lints = "deny"
unsafe_code = "deny"
unused_must_use = "deny"

[lints.clippy]
dbg_macro = "deny"
too_many_arguments = "allow"
4 changes: 2 additions & 2 deletions src/hll/aux_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//! Stores slot-value pairs for values that don't fit in the 4-bit main array.
//! Uses open addressing with stride-based probing for collision resolution.

use crate::hll::{RESIZE_DENOM, RESIZE_NUMER, get_slot, get_value, pack_coupon};
use crate::hll::{RESIZE_DENOMINATOR, RESIZE_NUMERATOR, get_slot, get_value, pack_coupon};

const ENTRY_EMPTY: u32 = 0;

Expand Down Expand Up @@ -175,7 +175,7 @@ impl AuxMap {
/// Check if we need to grow the hash table (75% load factor)
fn check_grow(&mut self) {
let size = 1 << self.lg_size;
if (RESIZE_DENOM * self.count) > (RESIZE_NUMER * size) {
if (RESIZE_DENOMINATOR * self.count) > (RESIZE_NUMERATOR * size) {
self.grow();
}
}
Expand Down
29 changes: 14 additions & 15 deletions src/hll/cubic_interpolation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ fn interpolate_using_x_arr_and_y_stride(
}

/// Cubic interpolation using the Lagrange interpolation formula.
#[allow(clippy::too_many_arguments)]
fn cubic_interpolate(
x0: f64,
y0: f64,
Expand All @@ -122,20 +121,20 @@ fn cubic_interpolate(
y3: f64,
x: f64,
) -> f64 {
let l0_numer = (x - x1) * (x - x2) * (x - x3);
let l1_numer = (x - x0) * (x - x2) * (x - x3);
let l2_numer = (x - x0) * (x - x1) * (x - x3);
let l3_numer = (x - x0) * (x - x1) * (x - x2);

let l0_denom = (x0 - x1) * (x0 - x2) * (x0 - x3);
let l1_denom = (x1 - x0) * (x1 - x2) * (x1 - x3);
let l2_denom = (x2 - x0) * (x2 - x1) * (x2 - x3);
let l3_denom = (x3 - x0) * (x3 - x1) * (x3 - x2);

let term0 = y0 * l0_numer / l0_denom;
let term1 = y1 * l1_numer / l1_denom;
let term2 = y2 * l2_numer / l2_denom;
let term3 = y3 * l3_numer / l3_denom;
let l0_numerator = (x - x1) * (x - x2) * (x - x3);
let l1_numerator = (x - x0) * (x - x2) * (x - x3);
let l2_numerator = (x - x0) * (x - x1) * (x - x3);
let l3_numerator = (x - x0) * (x - x1) * (x - x2);

let l0_denominator = (x0 - x1) * (x0 - x2) * (x0 - x3);
let l1_denominator = (x1 - x0) * (x1 - x2) * (x1 - x3);
let l2_denominator = (x2 - x0) * (x2 - x1) * (x2 - x3);
let l3_denominator = (x3 - x0) * (x3 - x1) * (x3 - x2);

let term0 = y0 * l0_numerator / l0_denominator;
let term1 = y1 * l1_numerator / l1_denominator;
let term2 = y2 * l2_numerator / l2_denominator;
let term3 = y3 * l3_numerator / l3_denominator;

term0 + term1 + term2 + term3
}
Expand Down
4 changes: 2 additions & 2 deletions src/hll/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ const KEY_MASK_26: u32 = (1 << KEY_BITS_26) - 1;
const COUPON_RSE_FACTOR: f64 = 0.409; // At transition point not the asymptote
const COUPON_RSE: f64 = COUPON_RSE_FACTOR / (1 << 13) as f64;

const RESIZE_NUMER: u32 = 3; // Resize at 3/4 = 75% load factor
const RESIZE_DENOM: u32 = 4;
const RESIZE_NUMERATOR: u32 = 3; // Resize at 3/4 = 75% load factor
const RESIZE_DENOMINATOR: u32 = 4;

/// Extract slot number (low 26 bits) from coupon
#[inline]
Expand Down
6 changes: 3 additions & 3 deletions src/hll/sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use crate::hll::container::Container;
use crate::hll::hash_set::HashSet;
use crate::hll::list::List;
use crate::hll::serialization::*;
use crate::hll::{HllType, NumStdDev, RESIZE_DENOM, RESIZE_NUMER, coupon};
use crate::hll::{HllType, NumStdDev, RESIZE_DENOMINATOR, RESIZE_NUMERATOR, coupon};

/// Current sketch mode
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
Expand Down Expand Up @@ -119,8 +119,8 @@ impl HllSketch {
}
Mode::Set { set, hll_type } => {
set.update(coupon);
let should_promote = RESIZE_DENOM as usize * set.container().len()
> RESIZE_NUMER as usize * set.container().capacity();
let should_promote = RESIZE_DENOMINATOR as usize * set.container().len()
> RESIZE_NUMERATOR as usize * set.container().capacity();
if should_promote {
self.mode = if set.container().lg_size() == self.lg_config_k as usize - 3 {
promote_container_to_array(set.container(), *hll_type, self.lg_config_k)
Expand Down
3 changes: 2 additions & 1 deletion typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
# under the License.

[default.extend-words]
"NUMER" = "NUMER"
# False-Positive Abbreviations
"PREINTS" = "PREINTS"

[files]
extend-exclude = []
Loading