MCPcopy Create free account
hub / github.com/bytedance/bolt / selectBaseRowsToLoad

Function selectBaseRowsToLoad

bolt/vector/LazyVector.cpp:139–177  ·  view source on GitHub ↗

Given a SelectivityVector 'rows', updates 'baseRows' selecting the rows in the base vector that should be loaded.

Source from the content-addressed store, hash-verified

137// Given a SelectivityVector 'rows', updates 'baseRows' selecting the rows
138// in the base vector that should be loaded.
139void selectBaseRowsToLoad(
140 const DecodedVector& decoded,
141 SelectivityVector& baseRows,
142 const SelectivityVector& rows) {
143 BOLT_DCHECK(
144 decoded.base()->encoding() == VectorEncoding::Simple::ROW ||
145 decoded.base()->encoding() == VectorEncoding::Simple::LAZY);
146
147 auto deselectNullsIdentity = [&]() {
148 if (decoded.base()->rawNulls()) {
149 baseRows.deselectNulls(
150 decoded.base()->rawNulls(), rows.begin(), rows.end());
151 }
152 };
153
154 if (decoded.isIdentityMapping() && rows.isAllSelected()) {
155 baseRows.resizeFill(rows.end(), true);
156 deselectNullsIdentity();
157 return;
158 }
159
160 if (decoded.isIdentityMapping()) {
161 baseRows.resizeFill(rows.end(), false);
162 baseRows.select(rows);
163 deselectNullsIdentity();
164 } else if (decoded.isConstantMapping()) {
165 baseRows.resizeFill(decoded.index(0) + 1, false);
166 baseRows.setValid(decoded.index(0), true);
167 } else {
168 baseRows.resizeFill(decoded.base()->size(), false);
169 rows.applyToSelected([&](vector_size_t row) {
170 if (!decoded.isNullAt(row)) {
171 baseRows.setValid(decoded.index(row), true);
172 }
173 });
174 }
175
176 baseRows.updateBounds();
177}
178} // namespace
179
180// static

Callers 1

ensureLoadedRowsImplMethod · 0.85

Calls 15

rawNullsMethod · 0.80
isIdentityMappingMethod · 0.80
isAllSelectedMethod · 0.80
resizeFillMethod · 0.80
selectMethod · 0.80
isConstantMappingMethod · 0.80
setValidMethod · 0.80
applyToSelectedMethod · 0.80
updateBoundsMethod · 0.80
encodingMethod · 0.45
baseMethod · 0.45
deselectNullsMethod · 0.45

Tested by

no test coverage detected