thorfour opened a new issue, #35621:
URL: https://github.com/apache/arrow/issues/35621
### Describe the bug, including details regarding any error messages,
version, and platform.
When you create a record with a list column, if you slice that array and
then try and encode the slices with the IPC writer, it produces incorrect
results when read back from the IPC format.
It appears to incorrectly address the offsets of a slice if the slice has a
non-zero offset. Below is an example test that fails because the second slice
returns the first two lists after IPC encoding instead of the expected last two
lists.
```
func Test_Arrow_SlicedList(t *testing.T) {
schema := arrow.NewSchema([]arrow.Field{
{
Name: "letters",
Type: arrow.ListOf(&arrow.StringType{}),
},
}, nil)
rb := array.NewRecordBuilder(memory.NewGoAllocator(), schema)
lb := rb.Field(0).(*array.ListBuilder)
sb := lb.ValueBuilder().(*array.StringBuilder)
lb.Append(true)
sb.Append("a")
sb.Append("b")
sb.Append("c")
lb.Append(true)
sb.Append("d")
sb.Append("e")
sb.Append("f")
lb.Append(true)
sb.Append("g")
sb.Append("h")
sb.Append("i")
r := rb.NewRecord()
r0 := r.NewSlice(0, 1)
r1 := r.NewSlice(1, 3)
b := &bytes.Buffer{}
w := ipc.NewWriter(b, ipc.WithSchema(r.Schema()))
require.NoError(t, w.Write(r0))
require.NoError(t, w.Write(r1))
require.NoError(t, w.Close())
rdr, err := ipc.NewReader(b)
require.NoError(t, err)
rdr.Next()
read0 := rdr.Record()
read0.Retain()
rdr.Next()
read1 := rdr.Record()
require.True(t, array.RecordEqual(r0, read0))
require.True(t, array.RecordEqual(r1, read1))
}
```
```
thor@thors-MacBook-Pro frostdb % go test -v -run SlicedList
=== RUN Test_Arrow_SlicedList
table_test.go:1773:
Error Trace:
/Users/thor/go/src/github.com/polarsignals/frostdb/table_test.go:1773
Error: Should be true
Test: Test_Arrow_SlicedList
--- FAIL: Test_Arrow_SlicedList (0.00s)
```
### 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]