Skip to content

Commit 38ed61a

Browse files
committed
performance: eliminate unnecessary null_counts calculations
after calculating the null_counts array in advance, there is no need to call GetColumnDatum to continue updating null_counts. We can directly read the datum.
1 parent 8315078 commit 38ed61a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

contrib/pax_storage/src/cpp/storage/orc/orc_group.cc

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,20 @@ std::pair<Datum, bool> OrcGroup::GetColumnValueNoMissing(size_t column_index,
293293
return {0, true};
294294
}
295295

296-
if (column->HasNull() && !nulls_shuffle_[column_index]) {
297-
CalcNullShuffle(column, column_index);
298-
}
296+
if (column->HasNull()) {
297+
const auto &bm = column->GetBitmap();
298+
Assert(bm);
299+
if (!bm->Test(row_index)) {
300+
return {0, true};
301+
}
299302

300-
if (nulls_shuffle_[column_index]) {
303+
// if not null value, calculate the null offsets array for each row
304+
if (!nulls_shuffle_[column_index]) {
305+
CalcNullShuffle(column, column_index);
306+
}
301307
null_counts = nulls_shuffle_[column_index][row_index];
302308
}
303-
304-
return GetColumnDatum(column, row_index, &null_counts);
309+
return {column->GetDatum(row_index - null_counts), false};
305310
}
306311

307312
void OrcGroup::CalcNullShuffle(PaxColumn *column, size_t column_index) {

0 commit comments

Comments
 (0)