hcrosse commented on code in PR #1490:
URL: https://github.com/apache/arrow-go/pull/1490#discussion_r4528699988
##########
arrow/scalar/scalar.go:
##########
@@ -834,10 +845,32 @@ func MakeArrayFromScalar(sc Scalar, length int, mem
memory.Allocator) (arrow.Arr
memory.Set(data.Bytes(), c)
return array.NewBoolean(length, data, nil, 0), nil
case BinaryScalar:
- if s.DataType().ID() == arrow.FIXED_SIZE_BINARY {
+ switch s.DataType().ID() {
+ case arrow.FIXED_SIZE_BINARY:
data := finishFixedWidth(s.Data())
defer data.Release()
return array.MakeFromData(data), nil
+ case arrow.BINARY_VIEW, arrow.STRING_VIEW:
+ value := s.Data()
+ if len(value) > math.MaxInt32 {
Review Comment:
I moved the guard into `Binary.Validate`, keyed on the declared view type,
so it covers `BinaryView`, `StringView` and plain `Binary` scalars with a view
type. `MakeArrayFromScalar` now calls `Validate`.
I kept a separate check in `FillFromScalar` because the compute path does
not validate first and it cannot return an error. It now panics on a 2 GiB
value, like the view builders, instead of writing a negative header size.
The size tests map address space without committing memory, run only on
Linux and macOS, and skip platforms with a 32 bit `int`.
--
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]