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

Method initialize

src/processor/operator/scan/scan_node_table.cpp:50–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50void ScanNodeTableSharedState::initialize(const transaction::Transaction* transaction,
51 NodeTable* table, ScanNodeTableProgressSharedState& progressSharedState) {
52 this->table = table;
53 this->currentCommittedGroupIdx = 0;
54 this->currentUnCommittedGroupIdx = 0;
55
56 // Initialize table-specific scan coordination (e.g., for IceDiskNodeTable)
57 table->initializeScanCoordination(transaction);
58
59 if (const auto iceDiskTable = dynamic_cast<IceDiskNodeTable*>(table)) {
60 // For ice-disk tables, set numCommittedNodeGroups to number of row groups
61 std::vector<bool> columnSkips;
62 try {
63 auto context = transaction->getClientContext();
64 auto resolvedPath =
65 common::VirtualFileSystem::resolvePath(context, iceDiskTable->getParquetFilePath());
66 auto tempReader =
67 std::make_unique<processor::ParquetReader>(resolvedPath, columnSkips, context);
68 this->numCommittedNodeGroups = tempReader->getNumRowGroups();
69 } catch (const std::exception& e) {
70 this->numCommittedNodeGroups = 1;
71 }
72 } else if (const auto arrowTable = dynamic_cast<ArrowNodeTable*>(table)) {
73 // For Arrow tables, set numCommittedNodeGroups to number of morsels
74 this->numCommittedNodeGroups =
75 static_cast<common::node_group_idx_t>(arrowTable->getNumScanMorsels(transaction));
76 } else {
77 this->numCommittedNodeGroups = table->getNumCommittedNodeGroups();
78 }
79 if (transaction->isWriteTransaction()) {
80 if (const auto localTable =
81 transaction->getLocalStorage()->getLocalTable(this->table->getTableID())) {
82 auto& localNodeTable = localTable->cast<LocalNodeTable>();
83 this->numUnCommittedNodeGroups = localNodeTable.getNumNodeGroups();
84 }
85 }
86 progressSharedState.numMorsels += numCommittedNodeGroups;
87}
88
89void ScanNodeTableSharedState::nextMorsel(TableScanState& scanState,
90 ScanNodeTableProgressSharedState& progressSharedState) {

Callers 2

Calls 6

getNumRowGroupsMethod · 0.80
getNumScanMorselsMethod · 0.80
getLocalTableMethod · 0.80
getClientContextMethod · 0.45
getNumNodeGroupsMethod · 0.45

Tested by

no test coverage detected