Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-expr/src/lib.rs
6939 views
1
#![cfg_attr(
2
feature = "allow_unused",
3
allow(unused, dead_code, irrefutable_let_patterns)
4
)] // Maybe be caused by some feature
5
mod expressions;
6
pub mod groups;
7
pub mod hash_keys;
8
pub mod hot_groups;
9
pub mod idx_table;
10
pub mod planner;
11
pub mod prelude;
12
pub mod reduce;
13
pub mod state;
14
15
use polars_utils::IdxSize;
16
17
pub use crate::planner::{ExpressionConversionState, create_physical_expr};
18
19
/// An index where the top bit indicates whether a value should be evicted.
20
pub struct EvictIdx(IdxSize);
21
22
impl EvictIdx {
23
#[inline(always)]
24
pub fn new(idx: IdxSize, should_evict: bool) -> Self {
25
debug_assert!(idx >> (IdxSize::BITS - 1) == 0);
26
Self(idx | ((should_evict as IdxSize) << (IdxSize::BITS - 1)))
27
}
28
29
#[inline(always)]
30
pub fn idx(&self) -> usize {
31
(self.0 & ((1 << (IdxSize::BITS - 1)) - 1)) as usize
32
}
33
34
#[inline(always)]
35
pub fn should_evict(&self) -> bool {
36
(self.0 >> (IdxSize::BITS - 1)) != 0
37
}
38
}
39
40