|
48 | 48 | DoubleType, |
49 | 49 | FixedType, |
50 | 50 | FloatType, |
| 51 | + GeographyType, |
| 52 | + GeometryType, |
51 | 53 | IcebergType, |
52 | 54 | IntegerType, |
53 | 55 | ListType, |
@@ -556,6 +558,10 @@ def primitive(self, primitive: PrimitiveType, primitive_partner: Optional[P]) -> |
556 | 558 | return self.visit_fixed(primitive, primitive_partner) |
557 | 559 | elif isinstance(primitive, BinaryType): |
558 | 560 | return self.visit_binary(primitive, primitive_partner) |
| 561 | + elif isinstance(primitive, GeographyType): |
| 562 | + return self.visit_geography(primitive, primitive_partner) |
| 563 | + elif isinstance(primitive, GeometryType): |
| 564 | + return self.visit_geometry(primitive, primitive_partner) |
559 | 565 | elif isinstance(primitive, UnknownType): |
560 | 566 | return self.visit_unknown(primitive, primitive_partner) |
561 | 567 | else: |
@@ -625,6 +631,14 @@ def visit_fixed(self, fixed_type: FixedType, partner: Optional[P]) -> T: |
625 | 631 | def visit_binary(self, binary_type: BinaryType, partner: Optional[P]) -> T: |
626 | 632 | """Visit a BinaryType.""" |
627 | 633 |
|
| 634 | + @abstractmethod |
| 635 | + def visit_geography(self, date_type: GeographyType, partner: Optional[P]) -> T: |
| 636 | + """Visit a GeographyType.""" |
| 637 | + |
| 638 | + @abstractmethod |
| 639 | + def visit_geometry(self, date_type: GeometryType, partner: Optional[P]) -> T: |
| 640 | + """Visit a GeometryType.""" |
| 641 | + |
628 | 642 | @abstractmethod |
629 | 643 | def visit_unknown(self, unknown_type: UnknownType, partner: Optional[P]) -> T: |
630 | 644 | """Visit a UnknownType.""" |
@@ -750,6 +764,10 @@ def primitive(self, primitive: PrimitiveType) -> T: |
750 | 764 | return self.visit_uuid(primitive) |
751 | 765 | elif isinstance(primitive, BinaryType): |
752 | 766 | return self.visit_binary(primitive) |
| 767 | + elif isinstance(primitive, GeographyType): |
| 768 | + return self.visit_geography(primitive) |
| 769 | + elif isinstance(primitive, GeometryType): |
| 770 | + return self.visit_geometry(primitive) |
753 | 771 | elif isinstance(primitive, UnknownType): |
754 | 772 | return self.visit_unknown(primitive) |
755 | 773 | else: |
@@ -819,6 +837,14 @@ def visit_uuid(self, uuid_type: UUIDType) -> T: |
819 | 837 | def visit_binary(self, binary_type: BinaryType) -> T: |
820 | 838 | """Visit a BinaryType.""" |
821 | 839 |
|
| 840 | + @abstractmethod |
| 841 | + def visit_geography(self, geography_type: GeographyType) -> T: |
| 842 | + """Visit a GeographyType.""" |
| 843 | + |
| 844 | + @abstractmethod |
| 845 | + def visit_geometry(self, geometry_type: GeometryType) -> T: |
| 846 | + """Visit a GeometryType.""" |
| 847 | + |
822 | 848 | @abstractmethod |
823 | 849 | def visit_unknown(self, unknown_type: UnknownType) -> T: |
824 | 850 | """Visit a UnknownType.""" |
@@ -1665,9 +1691,13 @@ def _(file_type: StringType, read_type: IcebergType) -> IcebergType: |
1665 | 1691 |
|
1666 | 1692 |
|
1667 | 1693 | @promote.register(BinaryType) |
| 1694 | +@promote.register(GeographyType) |
| 1695 | +@promote.register(GeometryType) |
1668 | 1696 | def _(file_type: BinaryType, read_type: IcebergType) -> IcebergType: |
1669 | 1697 | if isinstance(read_type, StringType): |
1670 | 1698 | return read_type |
| 1699 | + elif isinstance(read_type, (GeographyType, GeometryType)): |
| 1700 | + return read_type |
1671 | 1701 | else: |
1672 | 1702 | raise ResolveError(f"Cannot promote an binary to {read_type}") |
1673 | 1703 |
|
|
0 commit comments