diff --git a/duckpgq/src/duckpgq/functions/scalar/iterativelength.cpp b/duckpgq/src/duckpgq/functions/scalar/iterativelength.cpp index 7303ec22..10ab0113 100644 --- a/duckpgq/src/duckpgq/functions/scalar/iterativelength.cpp +++ b/duckpgq/src/duckpgq/functions/scalar/iterativelength.cpp @@ -137,7 +137,7 @@ static void IterativeLengthFunction(DataChunk &args, ExpressionState &state, int64_t search_num = lane_to_num[lane]; if (search_num >= 0) { // active lane int64_t dst_pos = vdata_dst.sel->get_index(search_num); - if (seen[dst_data[dst_pos]][lane]){ + if (seen[dst_data[dst_pos]][lane]) { result_data[search_num] = iter; /* found at iter => iter = path length */ lane_to_num[lane] = -1; // mark inactive diff --git a/duckpgq/src/duckpgq/functions/scalar/shortest_path.cpp b/duckpgq/src/duckpgq/functions/scalar/shortest_path.cpp index fd68ca52..7f857204 100644 --- a/duckpgq/src/duckpgq/functions/scalar/shortest_path.cpp +++ b/duckpgq/src/duckpgq/functions/scalar/shortest_path.cpp @@ -97,7 +97,7 @@ static void ShortestPathFunction(DataChunk &args, ExpressionState &state, vector> parents_v(v_size, std::vector(LANE_LIMIT, -1)); vector> parents_e(v_size, - std::vector(LANE_LIMIT, -1)); + std::vector(LANE_LIMIT, -1)); // maps lane to search number int16_t lane_to_num[LANE_LIMIT]; @@ -113,6 +113,10 @@ static void ShortestPathFunction(DataChunk &args, ExpressionState &state, for (auto i = 0; i < v_size; i++) { seen[i] = 0; visit1[i] = 0; + for (auto j = 0; j < LANE_LIMIT; j++) { + parents_v[i][j] = -1; + parents_e[i][j] = -1; + } } // add search jobs to free lanes