From 61611a91d9994e4bdfd8eb9e35739cba9be1aa01 Mon Sep 17 00:00:00 2001 From: Simon Lin Date: Thu, 4 Sep 2025 15:40:25 +1000 Subject: [PATCH 1/2] c --- crates/polars-io/src/cloud/adaptors.rs | 7 ------- crates/polars-io/src/utils/file.rs | 4 ---- 2 files changed, 11 deletions(-) diff --git a/crates/polars-io/src/cloud/adaptors.rs b/crates/polars-io/src/cloud/adaptors.rs index ba73b40c1f75..43416abd25b3 100644 --- a/crates/polars-io/src/cloud/adaptors.rs +++ b/crates/polars-io/src/cloud/adaptors.rs @@ -46,13 +46,6 @@ impl BlockingCloudWriter { /// Wrapper around `BlockingCloudWriter::new_with_object_store` that is useful if you only have a single write task. /// TODO: Naming? pub async fn new(uri: &str, cloud_options: Option<&CloudOptions>) -> PolarsResult { - if let Some(local_path) = uri.strip_prefix("file://") { - // Local paths must be created first, otherwise object store will not write anything. - if !matches!(std::fs::exists(local_path), Ok(true)) { - panic!("[BlockingCloudWriter] Expected local file to be created: {local_path}"); - } - } - let (cloud_location, object_store) = crate::cloud::build_object_store(uri, cloud_options, false).await?; Self::new_with_object_store( diff --git a/crates/polars-io/src/utils/file.rs b/crates/polars-io/src/utils/file.rs index 7b401fcb21a3..92ebdf6cacf7 100644 --- a/crates/polars-io/src/utils/file.rs +++ b/crates/polars-io/src/utils/file.rs @@ -71,10 +71,6 @@ impl Writeable { eprintln!("Writeable: try_new: cloud: {p}") } - if p.scheme() == CloudScheme::File { - create_file(Path::new(p.strip_scheme()))?; - } - let writer = crate::pl_async::get_runtime().block_in_place_on( BlockingCloudWriter::new(&p.to_string(), cloud_options), )?; From 113085170f844f450ee4a9331511c9594cb5095f Mon Sep 17 00:00:00 2001 From: Simon Lin Date: Thu, 4 Sep 2025 15:44:41 +1000 Subject: [PATCH 2/2] lint --- crates/polars-io/src/utils/file.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/polars-io/src/utils/file.rs b/crates/polars-io/src/utils/file.rs index 92ebdf6cacf7..bf0d4b078a37 100644 --- a/crates/polars-io/src/utils/file.rs +++ b/crates/polars-io/src/utils/file.rs @@ -1,6 +1,5 @@ use std::io; use std::ops::{Deref, DerefMut}; -use std::path::Path; #[cfg(feature = "cloud")] pub use async_writeable::AsyncWriteable; @@ -9,7 +8,7 @@ use polars_error::{PolarsError, PolarsResult, feature_gated}; use polars_utils::create_file; use polars_utils::file::{ClosableFile, WriteClose}; use polars_utils::mmap::ensure_not_mapped; -use polars_utils::plpath::{CloudScheme, PlPathRef}; +use polars_utils::plpath::PlPathRef; use super::sync_on_close::SyncOnCloseType; use crate::cloud::CloudOptions;