@@ -122,7 +122,7 @@ impl GeometryArray {
122
122
let coord_type = coord_types. into_iter ( ) . next ( ) . unwrap ( ) ;
123
123
124
124
Self {
125
- data_type : GeometryType :: new ( coord_type , metadata) ,
125
+ data_type : GeometryType :: new ( metadata) . with_coord_type ( coord_type ) ,
126
126
type_ids,
127
127
offsets,
128
128
points,
@@ -598,7 +598,8 @@ impl TryFrom<(&UnionArray, GeometryType)> for GeometryArray {
598
598
points[ index] = Some (
599
599
(
600
600
value. child ( type_id) . as_ref ( ) ,
601
- PointType :: new ( coord_type, dim, Default :: default ( ) ) ,
601
+ PointType :: new ( dim, Default :: default ( ) )
602
+ . with_coord_type ( coord_type) ,
602
603
)
603
604
. try_into ( ) ?,
604
605
) ;
@@ -607,7 +608,8 @@ impl TryFrom<(&UnionArray, GeometryType)> for GeometryArray {
607
608
line_strings[ index] = Some (
608
609
(
609
610
value. child ( type_id) . as_ref ( ) ,
610
- LineStringType :: new ( coord_type, dim, Default :: default ( ) ) ,
611
+ LineStringType :: new ( dim, Default :: default ( ) )
612
+ . with_coord_type ( coord_type) ,
611
613
)
612
614
. try_into ( ) ?,
613
615
) ;
@@ -616,7 +618,8 @@ impl TryFrom<(&UnionArray, GeometryType)> for GeometryArray {
616
618
polygons[ index] = Some (
617
619
(
618
620
value. child ( type_id) . as_ref ( ) ,
619
- PolygonType :: new ( coord_type, dim, Default :: default ( ) ) ,
621
+ PolygonType :: new ( dim, Default :: default ( ) )
622
+ . with_coord_type ( coord_type) ,
620
623
)
621
624
. try_into ( ) ?,
622
625
) ;
@@ -625,7 +628,8 @@ impl TryFrom<(&UnionArray, GeometryType)> for GeometryArray {
625
628
mpoints[ index] = Some (
626
629
(
627
630
value. child ( type_id) . as_ref ( ) ,
628
- MultiPointType :: new ( coord_type, dim, Default :: default ( ) ) ,
631
+ MultiPointType :: new ( dim, Default :: default ( ) )
632
+ . with_coord_type ( coord_type) ,
629
633
)
630
634
. try_into ( ) ?,
631
635
) ;
@@ -634,7 +638,8 @@ impl TryFrom<(&UnionArray, GeometryType)> for GeometryArray {
634
638
mline_strings[ index] = Some (
635
639
(
636
640
value. child ( type_id) . as_ref ( ) ,
637
- MultiLineStringType :: new ( coord_type, dim, Default :: default ( ) ) ,
641
+ MultiLineStringType :: new ( dim, Default :: default ( ) )
642
+ . with_coord_type ( coord_type) ,
638
643
)
639
644
. try_into ( ) ?,
640
645
) ;
@@ -643,7 +648,8 @@ impl TryFrom<(&UnionArray, GeometryType)> for GeometryArray {
643
648
mpolygons[ index] = Some (
644
649
(
645
650
value. child ( type_id) . as_ref ( ) ,
646
- MultiPolygonType :: new ( coord_type, dim, Default :: default ( ) ) ,
651
+ MultiPolygonType :: new ( dim, Default :: default ( ) )
652
+ . with_coord_type ( coord_type) ,
647
653
)
648
654
. try_into ( ) ?,
649
655
) ;
@@ -652,11 +658,8 @@ impl TryFrom<(&UnionArray, GeometryType)> for GeometryArray {
652
658
gcs[ index] = Some (
653
659
(
654
660
value. child ( type_id) . as_ref ( ) ,
655
- GeometryCollectionType :: new (
656
- coord_type,
657
- dim,
658
- Default :: default ( ) ,
659
- ) ,
661
+ GeometryCollectionType :: new ( dim, Default :: default ( ) )
662
+ . with_coord_type ( coord_type) ,
660
663
)
661
664
. try_into ( ) ?,
662
665
) ;
@@ -692,11 +695,10 @@ impl TryFrom<(&UnionArray, GeometryType)> for GeometryArray {
692
695
let new_val = if let Some ( arr) = arr. take ( ) {
693
696
arr
694
697
} else {
695
- PointBuilder :: new ( PointType :: new (
696
- coord_type,
697
- Dimension :: from_order ( i) . unwrap ( ) ,
698
- Default :: default ( ) ,
699
- ) )
698
+ PointBuilder :: new (
699
+ PointType :: new ( Dimension :: from_order ( i) . unwrap ( ) , Default :: default ( ) )
700
+ . with_coord_type ( coord_type) ,
701
+ )
700
702
. finish ( )
701
703
} ;
702
704
arr. replace ( new_val) ;
@@ -705,11 +707,10 @@ impl TryFrom<(&UnionArray, GeometryType)> for GeometryArray {
705
707
let new_val = if let Some ( arr) = arr. take ( ) {
706
708
arr
707
709
} else {
708
- LineStringBuilder :: new ( LineStringType :: new (
709
- coord_type,
710
- Dimension :: from_order ( i) . unwrap ( ) ,
711
- Default :: default ( ) ,
712
- ) )
710
+ LineStringBuilder :: new (
711
+ LineStringType :: new ( Dimension :: from_order ( i) . unwrap ( ) , Default :: default ( ) )
712
+ . with_coord_type ( coord_type) ,
713
+ )
713
714
. finish ( )
714
715
} ;
715
716
arr. replace ( new_val) ;
@@ -718,11 +719,10 @@ impl TryFrom<(&UnionArray, GeometryType)> for GeometryArray {
718
719
let new_val = if let Some ( arr) = arr. take ( ) {
719
720
arr
720
721
} else {
721
- PolygonBuilder :: new ( PolygonType :: new (
722
- coord_type,
723
- Dimension :: from_order ( i) . unwrap ( ) ,
724
- Default :: default ( ) ,
725
- ) )
722
+ PolygonBuilder :: new (
723
+ PolygonType :: new ( Dimension :: from_order ( i) . unwrap ( ) , Default :: default ( ) )
724
+ . with_coord_type ( coord_type) ,
725
+ )
726
726
. finish ( )
727
727
} ;
728
728
arr. replace ( new_val) ;
@@ -731,11 +731,10 @@ impl TryFrom<(&UnionArray, GeometryType)> for GeometryArray {
731
731
let new_val = if let Some ( arr) = arr. take ( ) {
732
732
arr
733
733
} else {
734
- MultiPointBuilder :: new ( MultiPointType :: new (
735
- coord_type,
736
- Dimension :: from_order ( i) . unwrap ( ) ,
737
- Default :: default ( ) ,
738
- ) )
734
+ MultiPointBuilder :: new (
735
+ MultiPointType :: new ( Dimension :: from_order ( i) . unwrap ( ) , Default :: default ( ) )
736
+ . with_coord_type ( coord_type) ,
737
+ )
739
738
. finish ( )
740
739
} ;
741
740
arr. replace ( new_val) ;
@@ -744,11 +743,10 @@ impl TryFrom<(&UnionArray, GeometryType)> for GeometryArray {
744
743
let new_val = if let Some ( arr) = arr. take ( ) {
745
744
arr
746
745
} else {
747
- MultiLineStringBuilder :: new ( MultiLineStringType :: new (
748
- coord_type,
749
- Dimension :: from_order ( i) . unwrap ( ) ,
750
- Default :: default ( ) ,
751
- ) )
746
+ MultiLineStringBuilder :: new (
747
+ MultiLineStringType :: new ( Dimension :: from_order ( i) . unwrap ( ) , Default :: default ( ) )
748
+ . with_coord_type ( coord_type) ,
749
+ )
752
750
. finish ( )
753
751
} ;
754
752
arr. replace ( new_val) ;
@@ -757,11 +755,10 @@ impl TryFrom<(&UnionArray, GeometryType)> for GeometryArray {
757
755
let new_val = if let Some ( arr) = arr. take ( ) {
758
756
arr
759
757
} else {
760
- MultiPolygonBuilder :: new ( MultiPolygonType :: new (
761
- coord_type,
762
- Dimension :: from_order ( i) . unwrap ( ) ,
763
- Default :: default ( ) ,
764
- ) )
758
+ MultiPolygonBuilder :: new (
759
+ MultiPolygonType :: new ( Dimension :: from_order ( i) . unwrap ( ) , Default :: default ( ) )
760
+ . with_coord_type ( coord_type) ,
761
+ )
765
762
. finish ( )
766
763
} ;
767
764
arr. replace ( new_val) ;
@@ -770,11 +767,13 @@ impl TryFrom<(&UnionArray, GeometryType)> for GeometryArray {
770
767
let new_val = if let Some ( arr) = arr. take ( ) {
771
768
arr
772
769
} else {
773
- GeometryCollectionBuilder :: new ( GeometryCollectionType :: new (
774
- coord_type,
775
- Dimension :: from_order ( i) . unwrap ( ) ,
776
- Default :: default ( ) ,
777
- ) )
770
+ GeometryCollectionBuilder :: new (
771
+ GeometryCollectionType :: new (
772
+ Dimension :: from_order ( i) . unwrap ( ) ,
773
+ Default :: default ( ) ,
774
+ )
775
+ . with_coord_type ( coord_type) ,
776
+ )
778
777
. finish ( )
779
778
} ;
780
779
arr. replace ( new_val) ;
@@ -910,59 +909,52 @@ type ChildrenArrays = (
910
909
fn empty_children ( coord_type : CoordType ) -> ChildrenArrays {
911
910
(
912
911
core:: array:: from_fn ( |i| {
913
- PointBuilder :: new ( PointType :: new (
914
- coord_type,
915
- Dimension :: from_order ( i) . unwrap ( ) ,
916
- Default :: default ( ) ,
917
- ) )
912
+ PointBuilder :: new (
913
+ PointType :: new ( Dimension :: from_order ( i) . unwrap ( ) , Default :: default ( ) )
914
+ . with_coord_type ( coord_type) ,
915
+ )
918
916
. finish ( )
919
917
} ) ,
920
918
core:: array:: from_fn ( |i| {
921
- LineStringBuilder :: new ( LineStringType :: new (
922
- coord_type,
923
- Dimension :: from_order ( i) . unwrap ( ) ,
924
- Default :: default ( ) ,
925
- ) )
919
+ LineStringBuilder :: new (
920
+ LineStringType :: new ( Dimension :: from_order ( i) . unwrap ( ) , Default :: default ( ) )
921
+ . with_coord_type ( coord_type) ,
922
+ )
926
923
. finish ( )
927
924
} ) ,
928
925
core:: array:: from_fn ( |i| {
929
- PolygonBuilder :: new ( PolygonType :: new (
930
- coord_type,
931
- Dimension :: from_order ( i) . unwrap ( ) ,
932
- Default :: default ( ) ,
933
- ) )
926
+ PolygonBuilder :: new (
927
+ PolygonType :: new ( Dimension :: from_order ( i) . unwrap ( ) , Default :: default ( ) )
928
+ . with_coord_type ( coord_type) ,
929
+ )
934
930
. finish ( )
935
931
} ) ,
936
932
core:: array:: from_fn ( |i| {
937
- MultiPointBuilder :: new ( MultiPointType :: new (
938
- coord_type,
939
- Dimension :: from_order ( i) . unwrap ( ) ,
940
- Default :: default ( ) ,
941
- ) )
933
+ MultiPointBuilder :: new (
934
+ MultiPointType :: new ( Dimension :: from_order ( i) . unwrap ( ) , Default :: default ( ) )
935
+ . with_coord_type ( coord_type) ,
936
+ )
942
937
. finish ( )
943
938
} ) ,
944
939
core:: array:: from_fn ( |i| {
945
- MultiLineStringBuilder :: new ( MultiLineStringType :: new (
946
- coord_type,
947
- Dimension :: from_order ( i) . unwrap ( ) ,
948
- Default :: default ( ) ,
949
- ) )
940
+ MultiLineStringBuilder :: new (
941
+ MultiLineStringType :: new ( Dimension :: from_order ( i) . unwrap ( ) , Default :: default ( ) )
942
+ . with_coord_type ( coord_type) ,
943
+ )
950
944
. finish ( )
951
945
} ) ,
952
946
core:: array:: from_fn ( |i| {
953
- MultiPolygonBuilder :: new ( MultiPolygonType :: new (
954
- coord_type,
955
- Dimension :: from_order ( i) . unwrap ( ) ,
956
- Default :: default ( ) ,
957
- ) )
947
+ MultiPolygonBuilder :: new (
948
+ MultiPolygonType :: new ( Dimension :: from_order ( i) . unwrap ( ) , Default :: default ( ) )
949
+ . with_coord_type ( coord_type) ,
950
+ )
958
951
. finish ( )
959
952
} ) ,
960
953
core:: array:: from_fn ( |i| {
961
- GeometryCollectionBuilder :: new ( GeometryCollectionType :: new (
962
- coord_type,
963
- Dimension :: from_order ( i) . unwrap ( ) ,
964
- Default :: default ( ) ,
965
- ) )
954
+ GeometryCollectionBuilder :: new (
955
+ GeometryCollectionType :: new ( Dimension :: from_order ( i) . unwrap ( ) , Default :: default ( ) )
956
+ . with_coord_type ( coord_type) ,
957
+ )
966
958
. finish ( )
967
959
} ) ,
968
960
)
@@ -978,7 +970,7 @@ macro_rules! impl_primitive_cast {
978
970
979
971
let type_ids = vec![ value. type_id( dim) ; value. len( ) ] . into( ) ;
980
972
let offsets = ScalarBuffer :: from_iter( 0 ..value. len( ) as i32 ) ;
981
- let data_type = GeometryType :: new( coord_type , metadata) ;
973
+ let data_type = GeometryType :: new( metadata) . with_coord_type ( coord_type ) ;
982
974
let mut children = empty_children( coord_type) ;
983
975
984
976
children. $value_edit[ dim. order( ) ] = value;
@@ -1035,7 +1027,7 @@ mod test {
1035
1027
1036
1028
fn geom_array ( coord_type : CoordType ) -> GeometryArray {
1037
1029
let geoms = geoms ( ) . into_iter ( ) . map ( Some ) . collect :: < Vec < _ > > ( ) ;
1038
- let typ = GeometryType :: new ( coord_type , Default :: default ( ) ) ;
1030
+ let typ = GeometryType :: new ( Default :: default ( ) ) . with_coord_type ( coord_type ) ;
1039
1031
GeometryBuilder :: from_nullable_geometries ( & geoms, typ)
1040
1032
. unwrap ( )
1041
1033
. finish ( )
@@ -1101,7 +1093,7 @@ mod test {
1101
1093
. filter_map ( |( i, geom) | if geom. is_none ( ) { Some ( i) } else { None } )
1102
1094
. collect :: < Vec < _ > > ( ) ;
1103
1095
1104
- let typ = GeometryType :: new ( CoordType :: Interleaved , Default :: default ( ) ) ;
1096
+ let typ = GeometryType :: new ( Default :: default ( ) ) ;
1105
1097
let geo_arr = GeometryBuilder :: from_nullable_geometries ( & geoms, typ)
1106
1098
. unwrap ( )
1107
1099
. finish ( ) ;
@@ -1116,7 +1108,7 @@ mod test {
1116
1108
let geoms = raw:: geometry:: geoms ( ) ;
1117
1109
let expected_nulls = NullBuffer :: from_iter ( geoms. iter ( ) . map ( |g| g. is_some ( ) ) ) ;
1118
1110
1119
- let typ = GeometryType :: new ( CoordType :: Interleaved , Default :: default ( ) ) ;
1111
+ let typ = GeometryType :: new ( Default :: default ( ) ) ;
1120
1112
let geo_arr = GeometryBuilder :: from_nullable_geometries ( & geoms, typ)
1121
1113
. unwrap ( )
1122
1114
. finish ( ) ;
0 commit comments