Commit 9f8b7b7
committed
fix: Cast smaller integer types to int32/int64 on write for Spark compatibility
When writing PyArrow tables with smaller integer types (uint8, int8,
int16, uint16) to Iceberg tables with IntegerType columns, PyIceberg
preserves the original Arrow type in the Parquet file. This causes
Spark to fail with:
java.lang.UnsupportedOperationException: Unsupported logical type: UINT_8
The fix casts smaller integer types to their canonical Iceberg
representation (int32 for IntegerType, int64 for LongType) during
write, ensuring cross-platform compatibility.
Only widening conversions are allowed - narrowing conversions (e.g.,
int64 to int32) continue to be rejected via the existing promote()
function.
Closes #27911 parent 65ba595 commit 9f8b7b7
2 files changed
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1903 | 1903 | | |
1904 | 1904 | | |
1905 | 1905 | | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
1906 | 1915 | | |
1907 | 1916 | | |
1908 | 1917 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2716 | 2716 | | |
2717 | 2717 | | |
2718 | 2718 | | |
| 2719 | + | |
| 2720 | + | |
| 2721 | + | |
| 2722 | + | |
| 2723 | + | |
| 2724 | + | |
| 2725 | + | |
| 2726 | + | |
| 2727 | + | |
| 2728 | + | |
| 2729 | + | |
| 2730 | + | |
| 2731 | + | |
| 2732 | + | |
| 2733 | + | |
| 2734 | + | |
| 2735 | + | |
| 2736 | + | |
| 2737 | + | |
| 2738 | + | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
| 2744 | + | |
| 2745 | + | |
| 2746 | + | |
| 2747 | + | |
| 2748 | + | |
| 2749 | + | |
| 2750 | + | |
2719 | 2751 | | |
2720 | 2752 | | |
2721 | 2753 | | |
| |||
0 commit comments