You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "minyoung (via GitHub)" <gi...@apache.org> on 2023/02/01 18:13:03 UTC
[GitHub] [arrow] minyoung commented on a diff in pull request #33965: GH-33875: [Go] Handle writing LargeString and LargeBinary types
minyoung commented on code in PR #33965:
URL: https://github.com/apache/arrow/pull/33965#discussion_r1093573505
##########
go/parquet/pqarrow/encode_arrow.go:
##########
@@ -421,12 +425,21 @@ func writeDenseArrow(ctx *arrowWriteContext, cw file.ColumnChunkWriter, leafArr
wr.WriteBatchSpaced(leafArr.(*array.Float64).Float64Values(), defLevels, repLevels, leafArr.NullBitmapBytes(), int64(leafArr.Data().Offset()))
}
case *file.ByteArrayColumnChunkWriter:
- if leafArr.DataType().ID() != arrow.STRING && leafArr.DataType().ID() != arrow.BINARY {
- return xerrors.New("invalid column type to write to ByteArray")
+ var offsets []int64
+ switch leafArr.DataType().ID() {
+ case arrow.STRING, arrow.BINARY:
+ off32 := leafArr.(binaryarr).ValueOffsets()
+ offsets = make([]int64, len(off32))
+ for i, o := range off32 {
+ offsets[i] = int64(o)
+ }
+ case arrow.LARGE_STRING, arrow.LARGE_BINARY:
+ offsets = leafArr.(binary64arr).ValueOffsets()
+ default:
+ return xerrors.New(fmt.Sprintf("invalid column type to write to ByteArray: %s", leafArr.DataType().Name()))
Review Comment:
That makes sense. Will shuffle the code around to use `ValueOffsets` as-is
--
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