polars_plan/
constants.rs

1use std::sync::OnceLock;
2
3use polars_utils::pl_str::PlSmallStr;
4
5pub static MAP_LIST_NAME: &str = "map_list";
6pub static CSE_REPLACED: &str = "__POLARS_CSER_";
7pub static POLARS_TMP_PREFIX: &str = "_POLARS_";
8pub const LEN: &str = "len";
9const LITERAL_NAME: &str = "literal";
10pub const UNLIMITED_CACHE: u32 = u32::MAX;
11
12// Cache the often used LITERAL and LEN constants
13static LITERAL_NAME_INIT: OnceLock<PlSmallStr> = OnceLock::new();
14static LEN_INIT: OnceLock<PlSmallStr> = OnceLock::new();
15
16pub fn get_literal_name() -> &'static PlSmallStr {
17    LITERAL_NAME_INIT.get_or_init(|| PlSmallStr::from_static(LITERAL_NAME))
18}
19pub(crate) fn get_len_name() -> PlSmallStr {
20    LEN_INIT
21        .get_or_init(|| PlSmallStr::from_static(LEN))
22        .clone()
23}