Skip to content

Commit

Permalink
Fix incorrect index
Browse files Browse the repository at this point in the history
  • Loading branch information
Dtenwolde committed Mar 7, 2024
1 parent d41fc4d commit fcc6a75
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class PhysicalPathFinding : public PhysicalComparisonJoin {

static void CreateCSR(DataChunk &input, GlobalCompressedSparseRow &global_csr);

bool IterativeLength(int64_t v_size, int64_t *v, vector<int64_t> &e,
static bool IterativeLength(int64_t v_size, int64_t *v, vector<int64_t> &e,
vector<std::bitset<LANE_LIMIT>> &seen,
vector<std::bitset<LANE_LIMIT>> &visit,
vector<std::bitset<LANE_LIMIT>> &next);
Expand Down
11 changes: 5 additions & 6 deletions duckpgq/src/duckpgq/operators/physical_path_finding_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ void PhysicalPathFinding::LocalCompressedSparseRow::Sink(
UnifiedVectorFormat vdata_dst;
src.ToUnifiedFormat(input.size(), vdata_src);
dst.ToUnifiedFormat(input.size(), vdata_dst);
auto src_data = (int64_t *)vdata_src.data;
auto dst_data = (int64_t *)vdata_dst.data;
auto src_data = vdata_src.data;
auto dst_data = vdata_dst.data;
Vector result = Vector(LogicalTypeId::BIGINT);
ValidityMask &result_validity = FlatVector::Validity(result);
result.SetVectorType(VectorType::FLAT_VECTOR);
Expand All @@ -144,12 +144,11 @@ void PhysicalPathFinding::LocalCompressedSparseRow::Sink(
vector<std::bitset<LANE_LIMIT>> visit1(v_size);
vector<std::bitset<LANE_LIMIT>> visit2(v_size);
short lane_to_num[LANE_LIMIT];
for (short & lane : lane_to_num) {
lane = -1; // inactive
for (int64_t lane = 0; lane < LANE_LIMIT; lane++) {
lane_to_num[lane] = -1; // inactive
}
idx_t started_searches = 0;
while (started_searches < input.size()) {

// empty visit vectors
for (auto i = 0; i < v_size; i++) {
seen[i] = 0;
Expand Down Expand Up @@ -200,7 +199,6 @@ void PhysicalPathFinding::LocalCompressedSparseRow::Sink(
}
}


// no changes anymore: any still active searches have no path
for (int64_t lane = 0; lane < LANE_LIMIT; lane++) {
int64_t search_num = lane_to_num[lane];
Expand All @@ -211,6 +209,7 @@ void PhysicalPathFinding::LocalCompressedSparseRow::Sink(
}
}
}
result.Print();
return;
}
CreateCSR(input, global_csr);
Expand Down

0 comments on commit fcc6a75

Please sign in to comment.