You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/08/05 20:52:11 UTC

[GitHub] [arrow] zeroshade commented on a diff in pull request #13806: ARROW-17276: [Go][Integratoin] Implement IPC handling for union type

zeroshade commented on code in PR #13806:
URL: https://github.com/apache/arrow/pull/13806#discussion_r939217901


##########
go/arrow/ipc/file_reader.go:
##########
@@ -617,6 +626,45 @@ func (ctx *arrayLoaderContext) loadStruct(dt *arrow.StructType) arrow.ArrayData
 	return array.NewData(dt, int(field.Length()), buffers, subs, int(field.NullCount()), 0)
 }
 
+func (ctx *arrayLoaderContext) loadUnion(dt arrow.UnionType) arrow.ArrayData {
+	nBuffers := 2

Review Comment:
   added



##########
go/arrow/ipc/file_reader.go:
##########
@@ -617,6 +626,45 @@ func (ctx *arrayLoaderContext) loadStruct(dt *arrow.StructType) arrow.ArrayData
 	return array.NewData(dt, int(field.Length()), buffers, subs, int(field.NullCount()), 0)
 }
 
+func (ctx *arrayLoaderContext) loadUnion(dt arrow.UnionType) arrow.ArrayData {
+	nBuffers := 2
+	if dt.Mode() == arrow.DenseMode {
+		nBuffers = 3
+	}
+
+	field, buffers := ctx.loadCommon(dt.ID(), nBuffers)
+	if field.NullCount() != 0 && buffers[0] != nil {
+		panic("cannot read pre-1.0.0 union array with top-level validity bitmap")

Review Comment:
   prefixed



##########
go/arrow/ipc/file_reader.go:
##########
@@ -381,6 +382,7 @@ func (src *ipcSource) buffer(i int) *memory.Buffer {
 	if !src.meta.Buffers(&buf, i) {
 		panic("buffer index out of bound")

Review Comment:
   prefixed



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org