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

Use file_name instead of path when checking for expected file extension #8265

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion datafusion/core/src/execution/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ impl SessionContext {
// check if the file extension matches the expected extension
for path in &table_paths {
let file_name = path.prefix().filename().unwrap_or_default();
if !path.as_str().ends_with(&option_extension) && file_name.contains('.') {
if !file_name.ends_with(&option_extension) && file_name.contains('.') {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this check is just ill-formed, if the ListingTableUrl is to a directory containing a . this check will reject it. I'm not sure what this check is here for tbh...

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if !file_name.ends_with(&option_extension) && file_name.contains('.') {
if !file_name.ends_with(&option_extension) && !path.is_collection() {

Perhaps?

Copy link
Member Author

Choose a reason for hiding this comment

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

That doesn't compile for me. Perhaps this method isn't available in the version of arrow-rs that we are currently using?

no method named `is_collection` found for reference `&ListingTableUrl` in the current scope

Copy link
Contributor

Choose a reason for hiding this comment

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

ListingTableUrl is a DataFusion concept, perhaps your checkout is behind main?

return exec_err!(
"File '{file_name}' does not match the expected extension '{option_extension}'"
);
Expand Down
Loading