zeroshade commented on code in PR #1385:
URL: https://github.com/apache/arrow-go/pull/1385#discussion_r4318796096
##########
arrow/ipc/ipc_test.go:
##########
@@ -1080,3 +1080,67 @@ func TestRecordBatchNoMetadataRoundtrip(t *testing.T) {
// Metadata should be empty, not nil
require.Equal(t, 0, rm.Metadata().Len())
}
+
+func TestListOfUnionSliceRoundTrip(t *testing.T) {
+ fields := []arrow.Field{
+ {Name: "a", Type: arrow.PrimitiveTypes.Int32, Nullable: true},
+ {Name: "b", Type: arrow.PrimitiveTypes.Int32, Nullable: true},
+ }
+ codes := []arrow.UnionTypeCode{3, 7}
+ for _, unionType := range []arrow.UnionType{
+ arrow.DenseUnionOf(fields, codes), arrow.SparseUnionOf(fields,
codes),
+ } {
+ for _, listType := range
[]arrow.DataType{arrow.ListOf(unionType), arrow.LargeListOf(unionType)} {
+ t.Run(listType.String(), func(t *testing.T) {
+ mem :=
memory.NewCheckedAllocator(memory.DefaultAllocator)
+ defer mem.AssertSize(t, 0)
+ arr, _, err := array.FromJSON(mem, listType,
strings.NewReader(`[[[3,11]],[[7,101],[3,null]],[[7,202],[3,33]]]`))
+ require.NoError(t, err)
+ defer arr.Release()
+ list := arr.(array.ListLike)
+ require.NoError(t, arr.(interface{
ValidateFull() error }).ValidateFull())
Review Comment:
`array.ValidateFull` (exported in `arrow/array/validate.go`) does this
without the inline interface cast. Could you use it here and at L1121 and L1139?
```suggestion
require.NoError(t, array.ValidateFull(arr))
```
The other two would become `array.ValidateFull(r.RecordBatch().Column(0))`
and `array.ValidateFull(out.Column(0))`.
--
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]