Skip to content

Commit

Permalink
Merge pull request #25 from timvw/fix-delta
Browse files Browse the repository at this point in the history
fix: discovery of delta tables
  • Loading branch information
timvw authored Sep 28, 2022
2 parents 0767af3 + 3e0092d commit e60c18d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/globbing_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ async fn load_listing_table(
globbing_path: &GlobbingPath,
) -> Result<ListingTable> {
let matching_file_urls = list_matching_table_urls(ctx, globbing_path).await?;
assert!(!matching_file_urls.is_empty());
let mut config = ListingTableConfig::new_with_multi_paths(matching_file_urls);
config = config.infer_options(&ctx.state()).await?;
config = config.infer_schema(&ctx.state()).await?;
Expand Down
8 changes: 5 additions & 3 deletions src/object_store_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ pub async fn list_matching_files<P>(
where
P: FnMut(&ObjectMeta) -> bool,
{
let items: Vec<ObjectMeta> = match store.head(prefix).await {
Ok(meta) => vec![meta],
Err(_) => store.list(Some(prefix)).await?.try_collect().await?,
let items: Vec<ObjectMeta> = store.list(Some(prefix)).await?.try_collect().await?;
let items = if items.is_empty() {
vec![store.head(prefix).await?]
} else {
items
};
let filtered_items = items.into_iter().filter(predicate).collect();
Ok(filtered_items)
Expand Down

0 comments on commit e60c18d

Please sign in to comment.