-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[Go] Panic reading nested empty list #35202
Comments
Could I be building an empty list incorrectly? |
@minyoung looks like you're building it just fine, I've figured out the issue and put up a PR to fix it which has been linked here. Please take a look and confirm that this fix works for your data that caused the original issue. (I used your example to add a unit test to the code in the PR which passes, but it would still be good to confirm the original cause is solved too) |
Thanks for having a look @zeroshade! Some of the panics are gone now 🎉 func (ps *ParquetIOTestSuite) TestNestedEmptyList() {
bldr := array.NewStructBuilder(memory.DefaultAllocator, arrow.StructOf(
arrow.Field{
Nullable: true,
Name: "root",
Type: arrow.StructOf(
arrow.Field{
Nullable: true,
Name: "child1",
Type: arrow.ListOf(arrow.StructOf(
arrow.Field{
Nullable: true,
Name: "child2",
Type: arrow.ListOf(arrow.StructOf(
arrow.Field{
Nullable: true,
Name: "name",
Type: arrow.BinaryTypes.String,
},
)),
},
)),
},
),
},
))
defer bldr.Release()
rootBldr := bldr.FieldBuilder(0).(*array.StructBuilder)
child1Bldr := rootBldr.FieldBuilder(0).(*array.ListBuilder)
child1ElBldr := child1Bldr.ValueBuilder().(*array.StructBuilder)
child2Bldr := child1ElBldr.FieldBuilder(0).(*array.ListBuilder)
leafBldr := child2Bldr.ValueBuilder().(*array.StructBuilder)
nameBldr := leafBldr.FieldBuilder(0).(*array.StringBuilder)
// target structure 8 times
// {
// "root": {
// "child1": [
// { "child2": [{ "name": "foo" }] },
// { "child2": [] }
// ]
// }
// }
for i := 0; i < 8; i++ {
bldr.Append(true)
rootBldr.Append(true)
child1Bldr.Append(true)
child1ElBldr.Append(true)
child2Bldr.Append(true)
leafBldr.Append(true)
nameBldr.Append("foo")
child1ElBldr.Append(true)
child2Bldr.Append(true)
}
arr := bldr.NewArray()
defer arr.Release()
field := arrow.Field{Name: "x", Type: arr.DataType(), Nullable: true}
expected := array.NewTable(
arrow.NewSchema([]arrow.Field{field}, nil),
[]arrow.Column{*arrow.NewColumn(field, arrow.NewChunked(field.Type, []arrow.Array{arr}))},
-1,
)
defer expected.Release()
ps.roundTripTable(expected, false)
} |
@minyoung Have you tested that version with the branch that fixes the panics in the PR? When I run the sample code you've provided (or update the test in the branch to match) I'm not able to replicate the panic in the branch with the fixes that is attached to this issue. |
@zeroshade I do still encounter a panic. I've created a PR (based on the referenced branch) and the automated tests there also panics |
No worries @zeroshade, thanks for having a look. Yes, we no longer get a panic with our dataset from before 🎉 |
### What changes are included in this PR? A simple check in the struct reader to validate that we're trying to read something with at least one child before we start trying to build a nullbitmap that wouldn't exist if there are 0 elements in the actual array. ### Are these changes tested? Yes a unit test is included in this change. * Closes: #35202 Authored-by: Matt Topol <zotthewizard@gmail.com> Signed-off-by: Matt Topol <zotthewizard@gmail.com>
…ache#35276) ### What changes are included in this PR? A simple check in the struct reader to validate that we're trying to read something with at least one child before we start trying to build a nullbitmap that wouldn't exist if there are 0 elements in the actual array. ### Are these changes tested? Yes a unit test is included in this change. * Closes: apache#35202 Authored-by: Matt Topol <zotthewizard@gmail.com> Signed-off-by: Matt Topol <zotthewizard@gmail.com>
…ache#35276) ### What changes are included in this PR? A simple check in the struct reader to validate that we're trying to read something with at least one child before we start trying to build a nullbitmap that wouldn't exist if there are 0 elements in the actual array. ### Are these changes tested? Yes a unit test is included in this change. * Closes: apache#35202 Authored-by: Matt Topol <zotthewizard@gmail.com> Signed-off-by: Matt Topol <zotthewizard@gmail.com>
…ache#35276) ### What changes are included in this PR? A simple check in the struct reader to validate that we're trying to read something with at least one child before we start trying to build a nullbitmap that wouldn't exist if there are 0 elements in the actual array. ### Are these changes tested? Yes a unit test is included in this change. * Closes: apache#35202 Authored-by: Matt Topol <zotthewizard@gmail.com> Signed-off-by: Matt Topol <zotthewizard@gmail.com>
Describe the bug, including details regarding any error messages, version, and platform.
We have some data that is causing a panic to happen. I've stripped the schema and data as much as I could and created a test case that panics:
Test output
Component(s)
Go
The text was updated successfully, but these errors were encountered: