minyoung opened a new issue, #35202:
URL: https://github.com/apache/arrow/issues/35202

   ### 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:
   
   ```golang
   func (ps *ParquetIOTestSuite) TestNestedEmptyList() {
        bldr := array.NewStructBuilder(memory.DefaultAllocator, arrow.StructOf(
                arrow.Field{
                        Name:     "root",
                        Type: arrow.StructOf(
                                arrow.Field{
                                        Name:     "child1",
                                        Type: arrow.ListOf(arrow.StructOf(
                                                arrow.Field{
                                                        Name:     "child2",
                                                        Type: 
arrow.ListOf(arrow.StructOf(
                                                                arrow.Field{
                                                                        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)
   
        // target structure
        // {
        //   "root": {
        //     "child1": [
        //       { "child2: [] }
        //     ]
        //   }
        // }
   
        bldr.Append(true)
        rootBldr.Append(true)
        child1Bldr.Append(true)
   
        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)
   }
   ```
   
   Test output
   ```
   $ go test ./parquet/pqarrow -run TestParquetArrowIO/TestNestedEmptyList
   panic: runtime error: index out of range [0] with length 0
   
   goroutine 41 [running]:
   
github.com/apache/arrow/go/v11/parquet/internal/utils.NewFirstTimeBitmapWriter(...)
           
/Users/minyoung/repo/arrow/go/parquet/internal/utils/bitmap_writer.go:83
   
github.com/apache/arrow/go/v11/parquet/file.defLevelsToBitmapInternal({0x140003eca00,
 0x1, 0x20}, {0x4f008e0?, 0x1?, 0x0?, 0x5108?}, 0x14000155160, 0xc8?)
           /Users/minyoung/repo/arrow/go/parquet/file/level_conversion.go:173 
+0x1dc
   github.com/apache/arrow/go/v11/parquet/file.DefLevelsToBitmap(...)
           /Users/minyoung/repo/arrow/go/parquet/file/level_conversion.go:186
   
github.com/apache/arrow/go/v11/parquet/pqarrow.(*structReader).BuildArray(0x140003fdec0,
 0x0)
           /Users/minyoung/repo/arrow/go/parquet/pqarrow/column_readers.go:279 
+0x148
   
github.com/apache/arrow/go/v11/parquet/pqarrow.(*listReader).BuildArray(0x1400040e140,
 0x1)
           /Users/minyoung/repo/arrow/go/parquet/pqarrow/column_readers.go:396 
+0x334
   
github.com/apache/arrow/go/v11/parquet/pqarrow.(*structReader).BuildArray(0x14000414000,
 0x1)
           /Users/minyoung/repo/arrow/go/parquet/pqarrow/column_readers.go:289 
+0x3b0
   
github.com/apache/arrow/go/v11/parquet/pqarrow.(*listReader).BuildArray(0x1400040e180,
 0x1)
           /Users/minyoung/repo/arrow/go/parquet/pqarrow/column_readers.go:396 
+0x334
   
github.com/apache/arrow/go/v11/parquet/pqarrow.(*structReader).BuildArray(0x14000414120,
 0x1)
           /Users/minyoung/repo/arrow/go/parquet/pqarrow/column_readers.go:289 
+0x3b0
   
github.com/apache/arrow/go/v11/parquet/pqarrow.(*structReader).BuildArray(0x14000414240,
 0x1)
           /Users/minyoung/repo/arrow/go/parquet/pqarrow/column_readers.go:289 
+0x3b0
   
github.com/apache/arrow/go/v11/parquet/pqarrow.(*ColumnReader).NextBatch(0x140003df490,
 0x1400039c6b0?)
           /Users/minyoung/repo/arrow/go/parquet/pqarrow/file_reader.go:134 
+0x68
   
github.com/apache/arrow/go/v11/parquet/pqarrow.(*FileReader).ReadColumn(0x1400039c780?,
 {0x140003dc8a8?, 0x14000125b60?, 0x0?}, 0x1400040e0c0?)
           /Users/minyoung/repo/arrow/go/parquet/pqarrow/file_reader.go:247 
+0x78
   
github.com/apache/arrow/go/v11/parquet/pqarrow.(*FileReader).ReadRowGroups.func1()
           /Users/minyoung/repo/arrow/go/parquet/pqarrow/file_reader.go:341 
+0xa4
   created by 
github.com/apache/arrow/go/v11/parquet/pqarrow.(*FileReader).ReadRowGroups
           /Users/minyoung/repo/arrow/go/parquet/pqarrow/file_reader.go:332 
+0x27c
   FAIL    github.com/apache/arrow/go/v11/parquet/pqarrow  0.407s
   FAIL
   ```
   
   ### Component(s)
   
   Go


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to