@@ -15,6 +15,9 @@ static GeoArrowErrorCode GeoArrowSchemaInitCoordFixedSizeList(struct ArrowSchema
15
15
NANOARROW_RETURN_NOT_OK (ArrowSchemaSetName (schema -> children [0 ], dims ));
16
16
NANOARROW_RETURN_NOT_OK (ArrowSchemaSetType (schema -> children [0 ], NANOARROW_TYPE_DOUBLE ));
17
17
18
+ // Set child field non-nullable
19
+ schema -> children [0 ]-> flags = 0 ;
20
+
18
21
return GEOARROW_OK ;
19
22
}
20
23
@@ -29,15 +32,17 @@ static GeoArrowErrorCode GeoArrowSchemaInitCoordStruct(struct ArrowSchema* schem
29
32
NANOARROW_RETURN_NOT_OK (
30
33
ArrowSchemaInitFromType (schema -> children [i ], NANOARROW_TYPE_DOUBLE ));
31
34
NANOARROW_RETURN_NOT_OK (ArrowSchemaSetName (schema -> children [i ], dim_name ));
35
+ // Set child non-nullable
36
+ schema -> children [i ]-> flags = 0 ;
32
37
}
33
38
34
39
return GEOARROW_OK ;
35
40
}
36
41
37
- static GeoArrowErrorCode GeoArrowSchemaInitListStruct (struct ArrowSchema * schema ,
38
- enum GeoArrowCoordType coord_type ,
39
- const char * dims , int n ,
40
- const char * * child_names ) {
42
+ static GeoArrowErrorCode GeoArrowSchemaInitListOf (struct ArrowSchema * schema ,
43
+ enum GeoArrowCoordType coord_type ,
44
+ const char * dims , int n ,
45
+ const char * * child_names ) {
41
46
if (n == 0 ) {
42
47
switch (coord_type ) {
43
48
case GEOARROW_COORD_TYPE_SEPARATE :
@@ -51,9 +56,14 @@ static GeoArrowErrorCode GeoArrowSchemaInitListStruct(struct ArrowSchema* schema
51
56
ArrowSchemaInit (schema );
52
57
NANOARROW_RETURN_NOT_OK (ArrowSchemaSetFormat (schema , "+l" ));
53
58
NANOARROW_RETURN_NOT_OK (ArrowSchemaAllocateChildren (schema , 1 ));
54
- NANOARROW_RETURN_NOT_OK (GeoArrowSchemaInitListStruct (schema -> children [0 ], coord_type ,
55
- dims , n - 1 , child_names + 1 ));
56
- return ArrowSchemaSetName (schema -> children [0 ], child_names [0 ]);
59
+ NANOARROW_RETURN_NOT_OK (GeoArrowSchemaInitListOf (schema -> children [0 ], coord_type ,
60
+ dims , n - 1 , child_names + 1 ));
61
+ NANOARROW_RETURN_NOT_OK (ArrowSchemaSetName (schema -> children [0 ], child_names [0 ]));
62
+
63
+ // Set child field non-nullable
64
+ schema -> children [0 ]-> flags = 0 ;
65
+
66
+ return NANOARROW_OK ;
57
67
}
58
68
}
59
69
@@ -112,32 +122,42 @@ GeoArrowErrorCode GeoArrowSchemaInit(struct ArrowSchema* schema, enum GeoArrowTy
112
122
case GEOARROW_GEOMETRY_TYPE_POINT :
113
123
switch (coord_type ) {
114
124
case GEOARROW_COORD_TYPE_SEPARATE :
115
- return GeoArrowSchemaInitCoordStruct (schema , dims );
125
+ NANOARROW_RETURN_NOT_OK (GeoArrowSchemaInitCoordStruct (schema , dims ));
126
+ break ;
116
127
case GEOARROW_COORD_TYPE_INTERLEAVED :
117
- return GeoArrowSchemaInitCoordFixedSizeList (schema , dims );
128
+ NANOARROW_RETURN_NOT_OK (GeoArrowSchemaInitCoordFixedSizeList (schema , dims ));
129
+ break ;
118
130
default :
119
131
return EINVAL ;
120
132
}
133
+ break ;
121
134
122
135
case GEOARROW_GEOMETRY_TYPE_LINESTRING :
123
- return GeoArrowSchemaInitListStruct (schema , coord_type , dims , 1 ,
124
- CHILD_NAMES_LINESTRING );
136
+ NANOARROW_RETURN_NOT_OK (
137
+ GeoArrowSchemaInitListOf (schema , coord_type , dims , 1 , CHILD_NAMES_LINESTRING ));
138
+ break ;
125
139
case GEOARROW_GEOMETRY_TYPE_MULTIPOINT :
126
- return GeoArrowSchemaInitListStruct (schema , coord_type , dims , 1 ,
127
- CHILD_NAMES_MULTIPOINT );
140
+ NANOARROW_RETURN_NOT_OK (
141
+ GeoArrowSchemaInitListOf (schema , coord_type , dims , 1 , CHILD_NAMES_MULTIPOINT ));
142
+ break ;
128
143
case GEOARROW_GEOMETRY_TYPE_POLYGON :
129
- return GeoArrowSchemaInitListStruct (schema , coord_type , dims , 2 ,
130
- CHILD_NAMES_POLYGON );
144
+ NANOARROW_RETURN_NOT_OK (
145
+ GeoArrowSchemaInitListOf (schema , coord_type , dims , 2 , CHILD_NAMES_POLYGON ));
146
+ break ;
131
147
case GEOARROW_GEOMETRY_TYPE_MULTILINESTRING :
132
- return GeoArrowSchemaInitListStruct (schema , coord_type , dims , 2 ,
133
- CHILD_NAMES_MULTILINESTRING );
148
+ NANOARROW_RETURN_NOT_OK (GeoArrowSchemaInitListOf (schema , coord_type , dims , 2 ,
149
+ CHILD_NAMES_MULTILINESTRING ));
150
+ break ;
134
151
case GEOARROW_GEOMETRY_TYPE_MULTIPOLYGON :
135
- return GeoArrowSchemaInitListStruct (schema , coord_type , dims , 3 ,
136
- CHILD_NAMES_MULTIPOLYGON );
152
+ NANOARROW_RETURN_NOT_OK (GeoArrowSchemaInitListOf (schema , coord_type , dims , 3 ,
153
+ CHILD_NAMES_MULTIPOLYGON ));
154
+ break ;
137
155
138
156
default :
139
157
return ENOTSUP ;
140
158
}
159
+
160
+ return NANOARROW_OK ;
141
161
}
142
162
143
163
GeoArrowErrorCode GeoArrowSchemaInitExtension (struct ArrowSchema * schema ,
0 commit comments