Skip to content

Commit

Permalink
windows :(
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Sep 26, 2023
1 parent 6d5667b commit 7a1f7db
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions crates/polars-plan/src/logical_plan/hive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,33 @@ pub struct HivePartitions {
stats: BatchStats,
}

#[cfg(target_os = "windows")]
fn separator(url: &Path) -> char {
if polars_io::is_cloud_url(url) {
'/'
} else {
'\\'
}
}

#[cfg(not(target_os = "windows"))]
fn separator(_url: &Path) -> char {
'/'
}

impl HivePartitions {
pub fn get_statistics(&self) -> &BatchStats {
&self.stats
}

/// Parse a url and optionally return HivePartitions
pub(crate) fn parse_url(url: &Path) -> Option<Self> {
let sep = separator(url);

let partitions = url
.as_os_str()
.to_str()?
.split('/')
.display()
.to_string()
.split(sep)
.filter_map(|part| {
let mut it = part.split('=');
let name = it.next()?;
Expand Down

0 comments on commit 7a1f7db

Please sign in to comment.