raulcd commented on issue #44651:
URL: https://github.com/apache/arrow/issues/44651#issuecomment-2457553242
ok, the problem seems to be if there is any null because this works:
```
>>> array2 = pa.array(['String longer than 12 characters', 'Short'],
type=pa.string_view())
>>> new_array = pa.StringViewArray.from_buffers(pa.string_view(),
len(array2), [array2.buffers()[1], array2.buffers()[2]])
>>> new_array
<pyarrow.lib.StringViewArray object at 0x73fc88321f60>
[
null,
null
]
>>> new_array.buffers()
[<pyarrow.Buffer address=0x3bac00303c0 size=32 is_cpu=True is_mutable=True>,
<pyarrow.Buffer address=0x3bac0030400 size=32 is_cpu=True is_mutable=True>]
```
even the original works if I cheat and tell from_buffers that the size is
one less than expected (avoid the null at the end):
```
>>> array1 = pa.array(['String longer than 12 characters', 'Short', None],
type=pa.string_view())
>>> pa.StringViewArray.from_buffers(pa.string_view(), len(array1)-1,
[array1.buffers()[1], array1.buffers()[2]])
<pyarrow.lib.StringViewArray object at 0x73fc88321f60>
[
null,
null
]
```
This seems like a bug :)
--
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]