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

Function tableFunc

src/function/table/cache_column.cpp:143–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143static offset_t tableFunc(const TableFuncInput& input, TableFuncOutput&) {
144 auto& bindData = input.bindData->cast<CacheArrayColumnBindData>();
145 const auto sharedState = input.sharedState->ptrCast<CacheArrayColumnSharedState>();
146 auto localState = input.localState->ptrCast<CacheArrayColumnLocalState>();
147 const auto morsel = sharedState->getMorsel();
148 if (morsel.isInvalid()) {
149 return 0;
150 }
151 auto context = input.context->clientContext;
152 auto columnType = bindData.tableEntry->getProperty(bindData.propertyID).getType().copy();
153 auto& table = sharedState->table;
154 auto& scanState = *localState->scanState;
155 for (auto i = morsel.startOffset; i < morsel.endOffset; i++) {
156 auto numRows = table.getNumTuplesInNodeGroup(i);
157 auto data = storage::ColumnChunkFactory::createColumnChunkData(
158 *storage::MemoryManager::Get(*context), columnType.copy(), false /*enableCompression*/,
159 numRows, storage::ResidencyState::IN_MEMORY, true /*hasNullData*/,
160 false /*initializeToZero*/);
161 if (columnType.getLogicalTypeID() == LogicalTypeID::ARRAY) {
162 auto arrayTypeInfo = columnType.getExtraTypeInfo()->constPtrCast<ArrayTypeInfo>();
163 data->cast<storage::ListChunkData>().getDataColumnChunk()->resize(
164 numRows * arrayTypeInfo->getNumElements());
165 }
166 scanTableDataToChunk(i, scanState, data.get(), transaction::Transaction::Get(*context),
167 table);
168 sharedState->merge(i, std::move(data));
169 }
170 return morsel.endOffset - morsel.startOffset;
171}
172
173static double progressFunc(TableFuncSharedState* sharedState) {
174 const auto cacheColumnSharedState = sharedState->ptrCast<CacheArrayColumnSharedState>();

Callers

nothing calls this directly

Calls 11

scanTableDataToChunkFunction · 0.85
isInvalidMethod · 0.80
getLogicalTypeIDMethod · 0.80
getExtraTypeInfoMethod · 0.80
getMorselMethod · 0.45
copyMethod · 0.45
getTypeMethod · 0.45
resizeMethod · 0.45
getNumElementsMethod · 0.45
getMethod · 0.45
mergeMethod · 0.45

Tested by

no test coverage detected