Skip to main content

polars_python/
cloud_client.rs

1use pyo3::prelude::{Python, *};
2use pyo3::types::PyBytes;
3
4use crate::PyLazyFrame;
5use crate::error::PyPolarsErr;
6
7#[pyfunction]
8pub fn prepare_cloud_plan(lf: PyLazyFrame, py: Python<'_>) -> PyResult<(Bound<'_, PyBytes>, u32)> {
9    let lf = lf.ldf.into_inner();
10    let opt_flags = lf.get_current_optimizations();
11    let plan = lf.logical_plan;
12    let bytes = polars::prelude::prepare_cloud_plan(plan).map_err(PyPolarsErr::from)?;
13
14    Ok((PyBytes::new(py, &bytes), opt_flags.bits()))
15}