Skip to content

Commit

Permalink
fix(plan): fix logic bug in planner helper method (#5115)
Browse files Browse the repository at this point in the history
Fixes #5114.
  • Loading branch information
Christopher M. Wolff authored Aug 19, 2022
1 parent b80a613 commit ac9b827
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libflux/go/libflux/buildinfo.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ var sourceHashes = map[string]string{
"stdlib/universe/simple_max_test.flux": "a63b3f530e4d81451e3c71a1abeea50cff02e743c9313ab3ffd5bc3b3ce9ad2e",
"stdlib/universe/skew_test.flux": "7782d41c563c77ba9f4176fa1b5f4f6107e418b7ea301e4896398dbcb514315a",
"stdlib/universe/sort2_test.flux": "1d2043c0d0b38abb8dc61fc1baa6d6052fae63fea55cc6e67fd1600911513bdb",
"stdlib/universe/sort_limit_test.flux": "c595da9613faf8734932d8c2e63291517b7842b5656f795b32d50e987493ec2a",
"stdlib/universe/sort_limit_test.flux": "32825b6b789c5b3287ae72967687a63fa3fee783e6626426c9b1cc7f39306dc8",
"stdlib/universe/sort_rules_test.flux": "0770ae42e99b04167ca5bef8340a310b224baf1ba1928997273de9663b64684a",
"stdlib/universe/sort_test.flux": "f69ebb5972762078e759af3c1cd3d852431a569dce74f3c379709c9e174bfa31",
"stdlib/universe/spread_test.flux": "1ddf25e4d86b6365da254229fc8f77bd838c24a79e6a08c9c4c50330ace0a6a3",
Expand Down
4 changes: 2 additions & 2 deletions plan/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ func mergePlanNodes(top, bottom, merged Node) (Node, error) {
}

merged.AddPredecessors(bottom.Predecessors()...)
for i, pred := range merged.Predecessors() {
for _, succ := range pred.Successors() {
for _, pred := range merged.Predecessors() {
for i, succ := range pred.Successors() {
if succ == bottom {
pred.Successors()[i] = merged
}
Expand Down
34 changes: 34 additions & 0 deletions stdlib/universe/sort_limit_test.flux
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,37 @@ testcase sort_limit_zero_row_table {

testing.diff(got, want)
}

testcase sort_limit_multi_successor {
input =
array.from(
rows: [
{_time: 2022-01-11T00:00:00Z, _value: 10.0},
{_time: 2022-01-11T01:00:00Z, _value: 12.0},
{_time: 2022-01-11T02:00:00Z, _value: 18.0},
{_time: 2022-01-11T03:00:00Z, _value: 4.0},
{_time: 2022-01-11T04:00:00Z, _value: 8.0},
],
)
in0 =
input
|> bottom(n: 2)
in1 =
input
|> top(n: 2)
got =
union(tables: [in0, in1])
|> sort(columns: ["_time"])

want =
array.from(
rows: [
{_time: 2022-01-11T01:00:00Z, _value: 12.0},
{_time: 2022-01-11T02:00:00Z, _value: 18.0},
{_time: 2022-01-11T03:00:00Z, _value: 4.0},
{_time: 2022-01-11T04:00:00Z, _value: 8.0},
],
)

testing.diff(got: got, want: want)
}

0 comments on commit ac9b827

Please sign in to comment.