Created
December 20, 2020 14:43
-
-
Save vertexclique/022cb3f61333d90e23fc0b9ccb9d1ad1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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