Skip to content

Commit

Permalink
The path returns -1 internally if it does not exist, but should not e…
Browse files Browse the repository at this point in the history
…nd up in the results
  • Loading branch information
SiberiaWolfP committed Feb 13, 2024
1 parent 49494a0 commit c90456d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions duckpgq/src/duckpgq/functions/scalar/iterativelength.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,12 @@ static void IterativeLengthFunction(DataChunk &args, ExpressionState &state,
int64_t dst_pos = vdata_dst.sel->get_index(search_num);
if (!vdata_src.validity.RowIsValid(src_pos)) {
result_validity.SetInvalid(search_num);
result_data[search_num] = (uint64_t)-1; /* no path */
result_data[search_num] = (int64_t)-1; /* no path */
} else if (src_data[src_pos] == dst_data[dst_pos]) {
result_data[search_num] =
(uint64_t)0; // path of length 0 does not require a search
(int64_t)0; // path of length 0 does not require a search
} else {
result_data[search_num] = (int64_t)-1; /* initialize to no path */
seen[src_data[src_pos]][lane] = true;
visit1[src_data[src_pos]][lane] = true;
lane_to_num[lane] = search_num; // active lane
Expand Down Expand Up @@ -181,6 +182,7 @@ static void IterativeLengthFunction(DataChunk &args, ExpressionState &state,
continue;
} else if (upper_bound.GetVectorType() == VectorType::CONSTANT_VECTOR ?
iter > upper_bound_data[0] : iter > upper_bound_data[dst_pos]) {
result_validity.SetInvalid(search_num);
result_data[search_num] = (int64_t)-1; /* no path */
} else {
result_data[search_num] =
Expand Down

0 comments on commit c90456d

Please sign in to comment.