Commit d08d5e6
### Rationale for this change
Fixes #48470. Also fixes all extension types, not just UUID.
### What changes are included in this PR?
An extension scalar is unwrapped to its storage type when building arrays.
### Are these changes tested?
Yes, new `test_array_from_extension_scalars` covers builtin (uuid, bool8, json_, opaque) and custom types across all storage types (int, float, bool, string, binary, large string/binary, decimal, fixed-size binary, struct, timestamp, duration, date).
### Are there any user-facing changes?
Now user can run such an example to get the output below instead of `ArrowInvalid` message.
This now works for any extension type, not just UUID.
```python
import pyarrow as pa
pa.array([pa.scalar(b'1'*16, type=pa.uuid())], type=pa.uuid())
```
```
<pyarrow.lib.UuidArray object at 0x128186970>
[
31313131313131313131313131313131
]
```
* GitHub Issue: #48470
Lead-authored-by: Tadeja Kadunc <tadeja.kadunc@gmail.com>
Co-authored-by: tadeja <tadeja@users.noreply.github.com>
Co-authored-by: Rok Mihevc <rok@mihevc.org>
Signed-off-by: Rok Mihevc <rok@mihevc.org>
1 parent 2cb1f2b commit d08d5e6
File tree
2 files changed
+74
-7
lines changed- python/pyarrow
- src/arrow/python
- tests
2 files changed
+74
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
584 | 584 | | |
585 | 585 | | |
586 | 586 | | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
587 | 595 | | |
588 | 596 | | |
589 | 597 | | |
| |||
663 | 671 | | |
664 | 672 | | |
665 | 673 | | |
666 | | - | |
| 674 | + | |
| 675 | + | |
667 | 676 | | |
668 | 677 | | |
669 | 678 | | |
| |||
684 | 693 | | |
685 | 694 | | |
686 | 695 | | |
687 | | - | |
| 696 | + | |
| 697 | + | |
688 | 698 | | |
689 | 699 | | |
690 | 700 | | |
| |||
710 | 720 | | |
711 | 721 | | |
712 | 722 | | |
713 | | - | |
| 723 | + | |
| 724 | + | |
714 | 725 | | |
715 | 726 | | |
716 | 727 | | |
| |||
747 | 758 | | |
748 | 759 | | |
749 | 760 | | |
750 | | - | |
| 761 | + | |
| 762 | + | |
751 | 763 | | |
752 | 764 | | |
753 | 765 | | |
| |||
791 | 803 | | |
792 | 804 | | |
793 | 805 | | |
794 | | - | |
| 806 | + | |
795 | 807 | | |
796 | 808 | | |
797 | 809 | | |
| |||
810 | 822 | | |
811 | 823 | | |
812 | 824 | | |
813 | | - | |
| 825 | + | |
814 | 826 | | |
815 | 827 | | |
816 | 828 | | |
| |||
983 | 995 | | |
984 | 996 | | |
985 | 997 | | |
986 | | - | |
| 998 | + | |
987 | 999 | | |
988 | 1000 | | |
989 | 1001 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
1486 | 1487 | | |
1487 | 1488 | | |
1488 | 1489 | | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
1489 | 1544 | | |
1490 | 1545 | | |
1491 | 1546 | | |
| |||
0 commit comments