-
Notifications
You must be signed in to change notification settings - Fork 155
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
feat(execute/table): Refactored the table builder interfaces to support null value creation. #790
Conversation
a59b56b
to
3f3339b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I don't like this change to the builder. I think the underlying problem to address is that invalid methods were used with arrow during the conversion and we should just fix those usage points rather than turn the Append
methods into array copy methods. I think it makes more sense to instead have a utility method that will copy an arrow array similar to how copy()
and io.Copy()
exist in the Go library.
I would much prefer that these fix the utility methods in arrow
to account for nils and fix the few places in the codebase that have the wrong usage.
I also think that this change makes it easier to inadvertently cause memory leaks.
I do think there's some good stuff in here though that I wish to see split. There's some fixes like having ValueForRow
account for null values which is desperately needed mixed with the API change and I think those two are separate.
@@ -187,7 +187,7 @@ func (t *differenceTransformation) Process(id execute.DatasetID, tbl flux.Table) | |||
d := differences[j] | |||
switch c.Type { | |||
case flux.TBool: | |||
if err := arrow.AppendBools(builder, j, arrow.BoolSlice(cr.Bools(j), firstIdx, l)); err != nil { | |||
if err := builder.AppendBools(j, arrow.BoolSlice(cr.Bools(j), firstIdx, l)); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how this got in originally, but it's a memory leak. You have to release the slice after creating it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will let this get fixed in a currently open PR for difference.
execute/table.go
Outdated
val = ValueForRow(cr, i, colMap[j]) | ||
err = builder.AppendValue(j, val) | ||
} else { | ||
switch c.Type { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why AppendNil
can't be used in this section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope. I will fix it.
Hey guys, I am not against this change as discussed in Slack. I leave the discussion to you and follow the thread. However, @jsternberg I can't see the point of having utilities to convert a call that uses go slices to one that uses arrow arrays, given that we should evolve to an arrow-oriented implementation and avoid the use of slices. Am I missing something? At the moment, I wrote down a fix to utils in #777
And use the offset of that specific column to set nils. So, I must append values one by one. @jsternberg For the memory leaks in |
I see the issues and I have some ideas. we can talk offline and then update this PR. |
For difference memory leaks, see #792 |
I talked with @aanthony1243 offline and both of us seemed to be in agreement that the current table builder API needed to be revisited and we would revisit it after the alpha. There were a few points that are important:
I'll give this another once over but let's just merge it so we have null support for the alpha and we'll revisit it later. We're not freezing any Go APIs yet anyway. |
07fa9ef
to
4c05461
Compare
…rt null value creation. Also fixed group and pivot tests that now get nulls correctly update spec
4de003f
to
a9c1a30
Compare
Done checklist