milesgranger commented on PR #14106:
URL: https://github.com/apache/arrow/pull/14106#issuecomment-1259068344
You bet, @changhiskhan, my pleasure! Below are some examples. Let me know if
you had any specific in mind. :)
`list<extension>`:
```python
import pyarrow as pa
from pyarrow.tests.test_extension_type import IntegerType
a = pa.array([[1, 2, 3]])
a.type
# ListType(list<item: int64>)
b = a.cast(pa.list_(IntegerType()))
b.type
# ListType(list<item: extension<arrow.py_extension_type<IntegerType>>>)
```
`struct<extension>`
```python
a = pa.array([{"foo": 1}])
a.type
# StructType(struct<foo: int64>)
b = a.cast(pa.struct([('foo', IntegerType())]))
b.type
# StructType(struct<foo: extension<arrow.py_extension_type<IntegerType>>>)
```
`list<struct<extension>>`
```python
a = pa.array([[{"foo": 1}]])
a.type
# ListType(list<item: struct<foo: int64>>)
b = a.cast(pa.list_(pa.struct([('foo', IntegerType())])))
b.type
# ListType(list<item: struct<foo:
extension<arrow.py_extension_type<IntegerType>>>>)
```
`struct<list<extension>>`
```python
a = pa.array([{"foo": [1, 2, 3]}])
a.type
# StructType(struct<foo: list<item: int64>>)
b = a.cast(pa.struct([('foo', pa.list_(IntegerType()))]))
b.type
# StructType(struct<foo: list<item:
extension<arrow.py_extension_type<IntegerType>>>>)
```
--
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]