Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong answer when input to findColumn is spread across multiple buffers #4884

Closed
wolffcm opened this issue Jun 15, 2022 · 0 comments · Fixed by #4885
Closed

Wrong answer when input to findColumn is spread across multiple buffers #4884

wolffcm opened this issue Jun 15, 2022 · 0 comments · Fixed by #4885
Assignees
Labels
kind/bug Something isn't working

Comments

@wolffcm
Copy link

wolffcm commented Jun 15, 2022

This test case will currently fail:

testcase findColumnWithGroup {
    // The result of grouping and then ungrouping
    // will be for a single table to be spread over
    // four buffers.
    input = array.from(rows: [
        {m: "m", k: "north", v: 10, _time: 2020-02-20T00:00:00Z},
        {m: "m", k: "south", v: 20, _time: 2020-02-20T00:00:00Z},
        {m: "m", k: "east", v: 30, _time: 2020-02-20T00:00:00Z},
        {m: "m", k: "west", v: 40, _time: 2020-02-20T00:00:00Z},
    ])
       |> group(columns: ["k"])
       |> range(start: -100y)
       |> group()

    arr = input |> findColumn(fn: (key) => true, column: "v")
    got = array.from(rows: [{val: display(v: arr)}])
    want = array.from(rows: [{val: display(v: [10, 20, 30, 40])}])
    testing.diff(got, want)
}

It fails like this on current master:

#  _diff=string,val=string
_diff=-,val=[
    10,
    20,
    30,
    40
]
_diff=+,val=[40]

That is, the result should be [10, 20, 30, 40] but it is [40]. This happens when the table input to findColumn and related functions is spread across multiple buffers which will happen in the query above. In this case, rather than concatenating the values in each row, it will simple take the single value in the last buffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant