Skip to content

Commit

Permalink
Check for local paths
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Jul 15, 2024
1 parent e19cff4 commit 2ae0906
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions crates/polars-plan/src/client/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mod dsl;

use polars_core::error::{polars_err, PolarsResult};
use polars_io::path_utils::is_cloud_url;

use crate::dsl::Expr;
use crate::plans::{DslFunction, DslPlan, FileScan, FunctionNode};
Expand All @@ -22,9 +23,15 @@ pub fn assert_cloud_eligible(dsl: &DslPlan) -> PolarsResult<()> {
_ => {},
},
DslPlan::Scan {
scan_type: FileScan::Anonymous { .. },
..
} => return ineligible_error("contains anonymous scan"),
paths, scan_type, ..
} => {
if matches!(scan_type, FileScan::Anonymous { .. }) {
return ineligible_error("contains anonymous scan");
}
if paths.lock().unwrap().0.iter().any(|p| !is_cloud_url(p)) {
return ineligible_error("contains scan of local file system");
}
},
DslPlan::GroupBy { apply: Some(_), .. } => {
return ineligible_error("contains Python function in group by operation")
},
Expand Down

0 comments on commit 2ae0906

Please sign in to comment.