disq commented on code in PR #34631:
URL: https://github.com/apache/arrow/pull/34631#discussion_r1159077375
##########
go/parquet/pqarrow/column_readers.go:
##########
@@ -543,21 +543,26 @@ func transferBinary(rdr file.RecordReader, dt
arrow.DataType) *arrow.Chunked {
return transferDictionary(brdr,
&arrow.DictionaryType{IndexType: arrow.PrimitiveTypes.Int32, ValueType: dt})
}
chunks := brdr.GetBuilderChunks()
- if dt == arrow.BinaryTypes.String || dt ==
arrow.BinaryTypes.LargeString {
- // convert chunks from binary to string without copying data,
- // just changing the interpretation of the metadata
- for idx := range chunks {
- chunks[idx] = array.MakeFromData(chunks[idx].Data())
- defer chunks[idx].Data().Release()
- defer chunks[idx].Release()
- }
- } else if dt.ID() == arrow.EXTENSION && len(chunks) > 0 &&
arrow.StorageTypeEqual(chunks[0].DataType(), dt) &&
!arrow.TypeEqual(chunks[0].DataType(), dt) {
- // convert chunks from the underlying storage type to extension
type without copying data
- etype := dt.(arrow.ExtensionType)
-
- for idx := range chunks {
- chunks[idx] = array.NewExtensionArrayWithStorage(etype,
chunks[idx])
- defer chunks[idx].Release()
+ storage := dt
+ if dt.ID() == arrow.EXTENSION {
+ storage = dt.(arrow.ExtensionType).StorageType()
+ }
+ if storage == arrow.BinaryTypes.String || storage ==
arrow.BinaryTypes.LargeString || dt.ID() == arrow.EXTENSION {
Review Comment:
`UUIDType`'s storage is `FixedSizeBinaryType` so there's no way it's going
inside that block without adding that check. And without it,
`TestArrowExtensionTypeRoundTrip`'s `roundTripTable` checks fail with:
> panic: invalid: arrow/array: mismatch data type fixed_size_binary[16] vs
extension_type<storage=fixed_size_binary[16]>
--
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]