MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / scanTableDataToChunk

Function scanTableDataToChunk

src/function/table/cache_column.cpp:121–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121static void scanTableDataToChunk(const node_group_idx_t nodeGroupIdx,
122 storage::NodeTableScanState& scanState, storage::ColumnChunkData* data,
123 transaction::Transaction* transaction, storage::NodeTable& table) {
124 scanState.nodeGroupIdx = nodeGroupIdx;
125 table.initScanState(transaction, scanState);
126
127 // We want to ensure that the offsets in the cached column match the offsets in the
128 // table
129 // To do this we write to the same offsets and set any non-selected (e.g. deleted)
130 // rows to null
131 data->getNullData()->resetToAllNull();
132 while (table.scan(transaction, scanState)) {
133 const auto& selVector = scanState.outState->getSelVector();
134 selVector.forEach([&](auto vectorIdx) {
135 const auto dataOffsetInGroup =
136 scanState.nodeIDVector->getValue<nodeID_t>(vectorIdx).offset -
137 storage::StorageUtils::getStartOffsetOfNodeGroup(nodeGroupIdx);
138 data->write(scanState.outputVectors[0], vectorIdx, dataOffsetInGroup);
139 });
140 }
141}
142
143static offset_t tableFunc(const TableFuncInput& input, TableFuncOutput&) {
144 auto& bindData = input.bindData->cast<CacheArrayColumnBindData>();

Callers 1

tableFuncFunction · 0.85

Calls 5

initScanStateMethod · 0.45
resetToAllNullMethod · 0.45
scanMethod · 0.45
forEachMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected