Skip to content
Closed
Show file tree
Hide file tree
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
20 changes: 9 additions & 11 deletions src/planning/iceberg_multi_file_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,6 @@ void IcebergMultiFileList::Bind(vector<LogicalType> &return_types, vector<Identi
std::move(temp_data), snapshot_info, *schema);
}

if (!view_initialized) {
InitializeFiles(guard);
}

auto &schema = GetSchema().columns;
for (auto &schema_entry : schema) {
names.push_back(Identifier(schema_entry->name));
Expand Down Expand Up @@ -466,10 +462,6 @@ vector<OpenFileInfo> IcebergMultiFileList::GetAllFiles() const {
}

FileExpandResult IcebergMultiFileList::GetExpandResult() const {
// GetFileInternal(1) will ensure files with index 0 and index 1 are expanded if they are available
lock_guard<mutex> guard(shared_state->lock);
GetFileInternal(1, guard);

// always return multiple files, In the case there is only 1 data file,
// we only lose performance if it is small
return FileExpandResult::MULTIPLE_FILES;
Expand All @@ -493,9 +485,10 @@ unique_ptr<NodeStatistics> IcebergMultiFileList::GetCardinality(ClientContext &c
return nullptr;
}

//! Make sure we have fetched all manifests
(void)GetTotalFileCount();
D_ASSERT(view_initialized);
if (!view_initialized) {
//! Avoid forcing manifest initialization before filter pushdown has had a chance to narrow the table.
return nullptr;
}

idx_t cardinality = 0;
for (idx_t i = 0; i < data_manifests.size(); i++) {
Expand Down Expand Up @@ -545,6 +538,11 @@ void IcebergMultiFileList::GetStatistics(vector<PartitionStatistics> &result) co
return;
}

if (!view_initialized) {
//! Avoid forcing manifest initialization before filter pushdown has had a chance to narrow the table.
return;
}

for (idx_t i = 0; i < delete_manifests.size(); i++) {
if (delete_manifest_matches[i]) {
//! if a matching delete manifest exists, return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ with cte as (
)
select CASE WHEN contains(val, '.') THEN (split(val, '.')[2]) ELSE NULL END FROM CTE ORDER BY ALL
----
avro
avro
NULL

statement ok
Expand Down Expand Up @@ -126,6 +124,8 @@ with cte as (
)
select CASE WHEN contains(val, '.') THEN (split(val, '.')[2]) ELSE NULL END FROM CTE ORDER BY ALL
----
avro
avro
parquet
NULL

Expand Down
Loading