From d5d262466907833b1890d4384427e8fa95607503 Mon Sep 17 00:00:00 2001 From: chiangchenghsin-hash Date: Fri, 3 Jul 2026 14:49:09 +0800 Subject: [PATCH 1/3] fix(vector): use real transaction + getNumTotalRows for HNSW index creation on Windows --- vector/src/function/create_hnsw_index.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vector/src/function/create_hnsw_index.cpp b/vector/src/function/create_hnsw_index.cpp index cb065cdb..16d5f096 100644 --- a/vector/src/function/create_hnsw_index.cpp +++ b/vector/src/function/create_hnsw_index.cpp @@ -57,11 +57,11 @@ static std::unique_ptr createInMemHNSWBindFunc(main::ClientCo } const auto tableID = nodeTableEntry->getTableID(); HNSWIndexUtils::validateColumnType(*nodeTableEntry, columnName); - const auto& table = + auto& table = storage::StorageManager::Get(*context)->getTable(tableID)->cast(); auto propertyID = nodeTableEntry->getPropertyID(columnName); auto transaction = transaction::Transaction::Get(*context); - auto numNodes = table.getStats(transaction).getTableCard(); + auto numNodes = table.getNumTotalRows(transaction); return std::make_unique(context, indexName, nodeTableEntry, propertyID, numNodes, std::move(config)); } From 5682ede9cf207cf1d37d59f32f3f137d632d0619 Mon Sep 17 00:00:00 2001 From: chiangchenghsin-hash Date: Fri, 3 Jul 2026 14:49:16 +0800 Subject: [PATCH 2/3] fix(vector): use real transaction + getNumTotalRows for HNSW index creation on Windows --- vector/src/index/hnsw_rel_batch_insert.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vector/src/index/hnsw_rel_batch_insert.cpp b/vector/src/index/hnsw_rel_batch_insert.cpp index a2435c37..61d8a4ff 100644 --- a/vector/src/index/hnsw_rel_batch_insert.cpp +++ b/vector/src/index/hnsw_rel_batch_insert.cpp @@ -125,6 +125,9 @@ void HNSWRelBatchInsert::writeToTable(processor::RelBatchInsertExecutionState& e common::idx_t neighbourIdx = 0; // write neighbour offset + unique rel ID for each rel for (const auto neighbourGraphOffset : neighbours) { + if (neighbourGraphOffset == common::INVALID_OFFSET) { + continue; + } const auto neighbourNodeOffset = selectionMap.graphToNodeOffset(neighbourGraphOffset); const auto relRowIdx = boundNodeCSROffset + neighbourIdx; const auto relID = startRelID + numRelsWritten; From e8a8011b1713a0420f90dcdc8ec0bdad3d5e75df Mon Sep 17 00:00:00 2001 From: chiangchenghsin-hash Date: Fri, 3 Jul 2026 14:51:23 +0800 Subject: [PATCH 3/3] fix(vector): use real transaction in OnDiskHNSWIndex::finalize (not DUMMY_CHECKPOINT_TRANSACTION) --- vector/src/index/hnsw_index.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vector/src/index/hnsw_index.cpp b/vector/src/index/hnsw_index.cpp index 3fe91941..79fe88a0 100644 --- a/vector/src/index/hnsw_index.cpp +++ b/vector/src/index/hnsw_index.cpp @@ -669,11 +669,11 @@ void OnDiskHNSWIndex::update(Transaction* transaction, const common::ValueVector void OnDiskHNSWIndex::finalize(main::ClientContext* context) { auto& hnswStorageInfo = storageInfo->cast(); - const auto numTotalRows = nodeTable.getNumTotalRows(&DUMMY_CHECKPOINT_TRANSACTION); + auto transaction = Transaction::Get(*context); + const auto numTotalRows = nodeTable.getNumTotalRows(transaction); if (numTotalRows == hnswStorageInfo.numCheckpointedNodes) { return; } - auto transaction = Transaction::Get(*context); auto [nodeTableEntry, upperRelTableEntry, lowerRelTableEntry] = getIndexTableCatalogEntries(catalog::Catalog::Get(*context), transaction, indexInfo); const auto embeddingDim = typeInfo.constPtrCast()->getNumElements();