Commit d3c7900
authored
fix: handle Null type in try_merge for Struct, List, LargeList, and Union (#9524)
# Which issue does this PR close?
Field::try_merge correctly handles DataType::Null for primitive types
and when self is Null, but fails when self is a compound type (Struct,
List, LargeList, Union) and from is Null. This causes Schema::try_merge
to error when merging schemas where one has a Null field and another has
a
concrete compound type for the same field.
This is common in JSON inference where some files have null values for
fields that are structs/lists in other files.
- Closes[ #9523](#9523)
# Rationale for this change
Add `DataType::Null` arms to the Struct, List, LargeList, and Union
branches in `Field::try_merge`, consistent with how primitive types
already handle it.
# What changes are included in this PR?
Add `DataType::Null` arms to the Struct, List, LargeList, and Union
branches in `Field::try_merge`, consistent with how primitive types
already handle it.
# Are these changes tested?
- Added test `test_merge_compound_with_null` covering Struct, List,
LargeList, and Union merging with Null in both directions.
- Existing tests continue to pass.
# Are there any user-facing changes?
No1 parent 33aed33 commit d3c7900
1 file changed
+66
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
830 | 830 | | |
831 | 831 | | |
832 | 832 | | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
833 | 836 | | |
834 | 837 | | |
835 | 838 | | |
| |||
841 | 844 | | |
842 | 845 | | |
843 | 846 | | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
844 | 850 | | |
845 | 851 | | |
846 | 852 | | |
| |||
854 | 860 | | |
855 | 861 | | |
856 | 862 | | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
857 | 866 | | |
858 | 867 | | |
859 | 868 | | |
| |||
867 | 876 | | |
868 | 877 | | |
869 | 878 | | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
870 | 882 | | |
871 | 883 | | |
872 | 884 | | |
| |||
1461 | 1473 | | |
1462 | 1474 | | |
1463 | 1475 | | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 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 | + | |
1464 | 1530 | | |
0 commit comments