Skip to content

Instantly share code, notes, and snippets.

@vertexclique
Created December 20, 2020 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vertexclique/022cb3f61333d90e23fc0b9ccb9d1ad1 to your computer and use it in GitHub Desktop.
Save vertexclique/022cb3f61333d90e23fc0b9ccb9d1ad1 to your computer and use it in GitHub Desktop.
use lever::index::zonemap::ZoneMap;
fn main() {
let customers: Vec<i32> = vec![
vec![1, 0, -1, -2].repeat(2),
vec![1, 2, 3, 4].repeat(3)
].concat();
let products = vec![4, 3, 2, 1].repeat(100);
let payouts = vec![4, 2, 6, 7].repeat(100);
let ingestion_data = vec![
("customers", customers.as_slice()),
("products", products.as_slice()),
("payouts", payouts.as_slice()),
];
let zone_map = ZoneMap::from(ingestion_data);
// Selectivity range is: [-2, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
assert_eq!(zone_map.selectivity_range("customers", 4, 4, &*customers), 13);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment