kevinjqliu commented on code in PR #1859:
URL: https://github.com/apache/iceberg-python/pull/1859#discussion_r2061808804
##########
pyiceberg/io/pyarrow.py:
##########
@@ -626,7 +626,7 @@ def field(self, field: NestedField, field_result:
pa.DataType) -> pa.Field:
def list(self, list_type: ListType, element_result: pa.DataType) ->
pa.DataType:
element_field = self.field(list_type.element_field, element_result)
- return pa.large_list(value_type=element_field)
+ return pa.list_(value_type=element_field)
Review Comment:
@fokko Just coming back to this PR. Is there a reason why we'd want to
default to `large_list`?
The difference between `list_` and `large_list` is the number of elements
supported by the list. According to the [`large_list`
docs](https://arrow.apache.org/docs/python/generated/pyarrow.large_list.html),
```
Unless you need to represent data larger than 2**31 elements, you should
prefer list_().
```
`2**31` is `2_147_483_648`, 2 billion items in the list seems pretty rare.
I did a small experiment, this works with `list_`
```
import pyarrow as pa
import numpy as np
size = 2**31 - 2
pa.array([np.zeros(size, dtype=np.int8)], type=pa.list_(pa.int8()))
```
but this will crash python, and would require `large_list`
```
import pyarrow as pa
import numpy as np
size = 2**31 - 1
pa.array([np.zeros(size, dtype=np.int8)], type=pa.list_(pa.int8()))
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]