| 252 | } |
| 253 | |
| 254 | static offset_t tableFunc(const TableFuncInput& input, TableFuncOutput& output) { |
| 255 | auto& dataChunk = output.dataChunk; |
| 256 | auto localState = dynamic_cast_checked<StorageInfoLocalState*>(input.localState); |
| 257 | DASSERT(dataChunk.state->getSelVector().isUnfiltered()); |
| 258 | auto storageManager = StorageManager::Get(*input.context->clientContext); |
| 259 | while (true) { |
| 260 | if (localState->currChunkIdx < localState->dataChunkCollection->getNumChunks()) { |
| 261 | // Copy from local state chunk. |
| 262 | const auto& chunk = |
| 263 | localState->dataChunkCollection->getChunkUnsafe(localState->currChunkIdx); |
| 264 | const auto numValuesToOutput = chunk.state->getSelVector().getSelSize(); |
| 265 | for (auto columnIdx = 0u; columnIdx < dataChunk.getNumValueVectors(); columnIdx++) { |
| 266 | const auto& localVector = chunk.getValueVector(columnIdx); |
| 267 | auto& outputVector = dataChunk.getValueVectorMutable(columnIdx); |
| 268 | for (auto i = 0u; i < numValuesToOutput; i++) { |
| 269 | outputVector.copyFromVectorData(i, &localVector, i); |
| 270 | } |
| 271 | } |
| 272 | dataChunk.state->getSelVectorUnsafe().setToUnfiltered(numValuesToOutput); |
| 273 | localState->currChunkIdx++; |
| 274 | return numValuesToOutput; |
| 275 | } |
| 276 | auto morsel = input.sharedState->ptrCast<SimpleTableFuncSharedState>()->getMorsel(); |
| 277 | if (!morsel.hasMoreToOutput()) { |
| 278 | return 0; |
| 279 | } |
| 280 | const auto bindData = input.bindData->constPtrCast<StorageInfoBindData>(); |
| 281 | StorageInfoOutputData outputData; |
| 282 | node_group_idx_t numNodeGroups = 0; |
| 283 | switch (bindData->tableEntry->getTableType()) { |
| 284 | case TableType::NODE: { |
| 285 | outputData.tableType = "NODE"; |
| 286 | auto table = storageManager->getTable(bindData->tableEntry->getTableID()); |
| 287 | auto& nodeTable = table->cast<NodeTable>(); |
| 288 | std::vector<const Column*> columns; |
| 289 | for (auto columnID = 0u; columnID < nodeTable.getNumColumns(); columnID++) { |
| 290 | columns.push_back(&nodeTable.getColumn(columnID)); |
| 291 | } |
| 292 | outputData.columns = std::move(columns); |
| 293 | numNodeGroups = nodeTable.getNumNodeGroups(); |
| 294 | for (auto i = 0ul; i < numNodeGroups; i++) { |
| 295 | outputData.nodeGroupIdx = i; |
| 296 | appendStorageInfoForNodeGroup(localState, dataChunk, outputData, |
| 297 | nodeTable.getNodeGroup(i)); |
| 298 | } |
| 299 | for (const auto& indexHolder : nodeTable.getIndexes()) { |
| 300 | if (indexHolder.isLoaded()) { |
| 301 | appendStorageInfoForIndex(localState, dataChunk, *indexHolder.getIndex()); |
| 302 | } |
| 303 | } |
| 304 | } break; |
| 305 | case TableType::REL: { |
| 306 | outputData.tableType = "REL"; |
| 307 | for (auto innerEntryInfo : |
| 308 | bindData->tableEntry->cast<RelGroupCatalogEntry>().getRelEntryInfos()) { |
| 309 | auto& relTable = storageManager->getTable(innerEntryInfo.oid)->cast<RelTable>(); |
| 310 | auto appendDirectedStorageInfo = [&](RelDataDirection direction) { |
| 311 | auto directedRelTableData = relTable.getDirectedTableData(direction); |
nothing calls this directly
no test coverage detected