()
| 745 | |
| 746 | |
| 747 | def test_schema_merge(): |
| 748 | a = pa.schema([ |
| 749 | pa.field('foo', pa.int32()), |
| 750 | pa.field('bar', pa.string()), |
| 751 | pa.field('baz', pa.list_(pa.int8())) |
| 752 | ]) |
| 753 | b = pa.schema([ |
| 754 | pa.field('foo', pa.int32()), |
| 755 | pa.field('qux', pa.bool_()) |
| 756 | ]) |
| 757 | c = pa.schema([ |
| 758 | pa.field('quux', pa.dictionary(pa.int32(), pa.string())) |
| 759 | ]) |
| 760 | d = pa.schema([ |
| 761 | pa.field('foo', pa.int64()), |
| 762 | pa.field('qux', pa.bool_()) |
| 763 | ]) |
| 764 | |
| 765 | result = pa.unify_schemas([a, b, c]) |
| 766 | expected = pa.schema([ |
| 767 | pa.field('foo', pa.int32()), |
| 768 | pa.field('bar', pa.string()), |
| 769 | pa.field('baz', pa.list_(pa.int8())), |
| 770 | pa.field('qux', pa.bool_()), |
| 771 | pa.field('quux', pa.dictionary(pa.int32(), pa.string())) |
| 772 | ]) |
| 773 | assert result.equals(expected) |
| 774 | |
| 775 | with pytest.raises(pa.ArrowTypeError): |
| 776 | pa.unify_schemas([b, d]) |
| 777 | |
| 778 | # ARROW-14002: Try with tuple instead of list |
| 779 | result = pa.unify_schemas((a, b, c)) |
| 780 | assert result.equals(expected) |
| 781 | |
| 782 | result = pa.unify_schemas([b, d], promote_options="permissive") |
| 783 | assert result.equals(d) |
| 784 | |
| 785 | # raise proper error when passing a non-Schema value |
| 786 | with pytest.raises(TypeError): |
| 787 | pa.unify_schemas([a, 1]) |
| 788 | |
| 789 | |
| 790 | def test_undecodable_metadata(): |
nothing calls this directly
no test coverage detected