Commits


Nick Poorman authored and Neal Richardson committed 72e89c0cd67
ARROW-6868: [Go] Fix slicing struct arrays This PR fixes the issue in: https://issues.apache.org/jira/browse/ARROW-6868 Slicing the struct array should result in `"{[1.3 1.4] [(null) 4]}"`, however the entire struct array is returned on a call to `arr.String()`: `"{[1.1 (null) 1.3 1.4] [1 2 (null) 4]}"`. The fix was to adjust Data to account for the new offset/length: ``` sub := NewSliceData(child, int64(data.offset), int64(data.offset+data.length)) ``` Result of the test before the fix: ``` === RUN TestStructArraySlice --- FAIL: TestStructArraySlice (0.00s) /arrow/go/arrow/array/struct_test.go:358: invalid string representation: got = "{[1.1 (null) 1.3 1.4] [1 2 (null) 4]}" want= "{[1.3 1.4] [(null) 4]}" FAIL FAIL github.com/apache/arrow/go/arrow/array 0.043s Error: Tests failed. ``` Closes #5642 from nickpoorman/ARROW-6868-struct-slicing and squashes the following commits: 4cfef3c61 <Nick Poorman> Moved newStructFieldWithParentValidityMask to a method on struct a4a11bf83 <Nick Poorman> Defer Release() 7223fb780 <Nick Poorman> Merge branch 'master' into ARROW-6868-struct-slicing a012a2c3b <Nick Poorman> Fixed String() on Struct type to accont for parent validity bitmap 5c7b4efee <Nick Poorman> Trying to fix the tests d151ced50 <Nick Poorman> Test passing for slicing struct array bf42e0286 <Nick Poorman> Added failing test case Authored-by: Nick Poorman <nickpoorman@gmail.com> Signed-off-by: Neal Richardson <neal.p.richardson@gmail.com>