Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't see files as hive partitions #14128

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions crates/polars-plan/src/logical_plan/hive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ impl HivePartitions {
let name = it.next()?;
let value = it.next()?;

// Don't see files `foo=1.parquet` as hive partitions.
// So we return globs and paths with extensions.
if value.contains('*') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you meant to put a "." here because it still picks up foo as a hive partition. That said, it's probably better to treat the last split as the file rather than trying to decide it's a file by its name.

return None;
}
let value_path = Path::new(value);
if value_path.extension().is_some() {
return None;
}

// Having multiple '=' doesn't seem like valid hive partition,
// continue as url.
if it.next().is_some() {
Expand Down
Loading