Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-python/src/cloud_client.rs
8327 views
1
use pyo3::prelude::{Python, *};
2
use pyo3::types::PyBytes;
3
4
use crate::PyLazyFrame;
5
use crate::error::PyPolarsErr;
6
7
#[pyfunction]
8
pub fn prepare_cloud_plan(
9
lf: PyLazyFrame,
10
allow_local_scans: bool,
11
py: Python<'_>,
12
) -> PyResult<(Bound<'_, PyBytes>, u32)> {
13
let lf = lf.ldf.into_inner();
14
let opt_flags = lf.get_current_optimizations();
15
let plan = lf.logical_plan;
16
let bytes =
17
polars::prelude::prepare_cloud_plan(plan, allow_local_scans).map_err(PyPolarsErr::from)?;
18
19
Ok((PyBytes::new(py, &bytes), opt_flags.bits()))
20
}
21
22