| 128 | } |
| 129 | |
| 130 | uint64_t StorageDriver::getNumRels(const std::string& relName) const { |
| 131 | clientContext->query("BEGIN TRANSACTION READ ONLY;"); |
| 132 | auto transaction = Transaction::Get(*clientContext); |
| 133 | auto catalogEntry = getEntry(*clientContext, relName); |
| 134 | |
| 135 | if (catalogEntry->getType() != CatalogEntryType::REL_GROUP_ENTRY) { |
| 136 | clientContext->query("COMMIT"); |
| 137 | throw RuntimeException(std::format("{} is not a relationship table", relName)); |
| 138 | } |
| 139 | |
| 140 | uint64_t result = 0; |
| 141 | auto relGroupCatalogEntry = catalogEntry->ptrCast<RelGroupCatalogEntry>(); |
| 142 | |
| 143 | for (const auto& relTableInfo : relGroupCatalogEntry->getRelEntryInfos()) { |
| 144 | auto table = StorageManager::Get(*clientContext)->getTable(relTableInfo.oid); |
| 145 | result += table->getNumTotalRows(transaction); |
| 146 | } |
| 147 | |
| 148 | clientContext->query("COMMIT"); |
| 149 | return result; |
| 150 | } |
| 151 | |
| 152 | void StorageDriver::scanColumn(Table* table, column_id_t columnID, const offset_t* offsets, |
| 153 | size_t size, uint8_t* result) const { |