Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.

Commit e00a35e

Browse files
committed
Compute table stats and chunk stats for materialized dictionaries
1 parent cd9f802 commit e00a35e

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

omniscidb/ArrowStorage/ArrowStorage.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,12 +478,26 @@ void ArrowStorage::materializeDictionary(DictionaryData* dict) {
478478

479479
VLOG(1) << "Materialized string dictionary for column " << col_id << " in table "
480480
<< table_id;
481-
for (auto& frag : table.fragments) {
481+
482+
{
483+
auto& frag = table.fragments.front();
484+
CHECK_LT(static_cast<size_t>(col_id), frag.metadata.size());
485+
auto& meta = frag.metadata[col_id];
486+
// compute chunk stats is multi threaded, so we single thread this
487+
auto stats =
488+
computeStats(new_col_data->Slice(frag.offset, frag.row_count), dict->type);
489+
meta->fillChunkStats(stats);
490+
table.table_stats[columnId(col_id)] = stats;
491+
}
492+
for (size_t i = 1; i < table.fragments.size(); i++) {
493+
auto& frag = table.fragments[i];
482494
CHECK_LT(static_cast<size_t>(col_id), frag.metadata.size());
483495
auto& meta = frag.metadata[col_id];
484496
// compute chunk stats is multi threaded, so we single thread this
485-
meta->fillChunkStats(
486-
computeStats(new_col_data->Slice(frag.offset, frag.row_count), dict->type));
497+
auto stats =
498+
computeStats(new_col_data->Slice(frag.offset, frag.row_count), dict->type);
499+
meta->fillChunkStats(stats);
500+
mergeStats(table.table_stats[columnId(col_id)], stats, dict->type);
487501
}
488502

489503
table.col_data[col_id] = new_col_data;

0 commit comments

Comments
 (0)