polars_plan/
global.rs

1use std::cell::Cell;
2
3// Will be set/ unset in the fetch operation to communicate overwriting the number of rows to scan.
4thread_local! {pub static FETCH_ROWS: Cell<Option<usize>> = const { Cell::new(None) }}
5
6pub fn _set_n_rows_for_scan(n_rows: Option<usize>) -> Option<usize> {
7    let fetch_rows = FETCH_ROWS.with(|fetch_rows| fetch_rows.get());
8    fetch_rows.or(n_rows)
9}
10
11pub fn _is_fetch_query() -> bool {
12    FETCH_ROWS.with(|fetch_rows| fetch_rows.get().is_some())
13}