Created
December 20, 2020 14:06
-
-
Save vertexclique/5f23d3cf7eb0130936fa412096b6d591 to your computer and use it in GitHub Desktop.
Simple zone map usage
This file contains 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(500), | |
vec![1, 2, 3, 4].repeat(250) | |
].concat(); | |
let ingestion_data = vec![ | |
("customers", customers.as_slice()), | |
]; | |
let zm = ZoneMap::from(ingestion_data); | |
let (l, r) = zm.scan_range("customers", 4, 4, &*customers); | |
customers[l..=r].iter().filter(|x| **x >= 4).sum::<i32>() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment