@@ -110,6 +110,27 @@ type SizeStatistics struct {
110110 DefinitionLevelHistogram []int64 `thrift:"3,optional"`
111111}
112112
113+ // Bounding box for GEOMETRY or GEOGRAPHY type in the representation of min/max
114+ // value pair of coordinates from each axis.
115+ type BoundingBox struct {
116+ XMin float64 `thrift:"1,required"`
117+ XMax float64 `thrift:"2,required"`
118+ YMin float64 `thrift:"3,required"`
119+ YMax float64 `thrift:"4,required"`
120+ ZMin * float64 `thrift:"5,optional"`
121+ ZMax * float64 `thrift:"6,optional"`
122+ MMin * float64 `thrift:"7,optional"`
123+ MMax * float64 `thrift:"8,optional"`
124+ }
125+
126+ // Statistics specific to Geometry and Geography logical types
127+ type GeospatialStatistics struct {
128+ // A bounding box of geospatial instances
129+ BBox * BoundingBox `thrift:"1,optional"`
130+ // Geospatial type codes of all instances, or an empty list if not known
131+ GeoSpatialTypes []int32 `thrift:"2,optional"`
132+ }
133+
113134// Statistics per row group and per page.
114135// All fields are optional.
115136type Statistics struct {
@@ -265,6 +286,86 @@ type VariantType struct{}
265286
266287func (* VariantType ) String () string { return "VARIANT" }
267288
289+ // Edge interpolation algorithm for Geography logical type
290+ type EdgeInterpolationAlgorithm int32
291+
292+ const (
293+ Spherical EdgeInterpolationAlgorithm = 0
294+ Vincenty EdgeInterpolationAlgorithm = 1
295+ Thomas EdgeInterpolationAlgorithm = 2
296+ Andoyer EdgeInterpolationAlgorithm = 3
297+ Karney EdgeInterpolationAlgorithm = 4
298+ )
299+
300+ func (e EdgeInterpolationAlgorithm ) String () string {
301+ switch e {
302+ case Spherical :
303+ return "SPHERICAL"
304+ case Vincenty :
305+ return "VINCENTY"
306+ case Thomas :
307+ return "THOMAS"
308+ case Andoyer :
309+ return "ANDOYER"
310+ case Karney :
311+ return "KARNEY"
312+ default :
313+ return "EdgeInterpolationAlgorithm(?)"
314+ }
315+ }
316+
317+ // Embedded Geometry logical type annotation
318+ //
319+ // Geospatial features in the Well-Known Binary (WKB) format and edges interpolation
320+ // is always linear/planar.
321+ //
322+ // A custom CRS can be set by the crs field. If unset, it defaults to "OGC:CRS84",
323+ // which means that the geometries must be stored in longitude, latitude based on
324+ // the WGS84 datum.
325+ //
326+ // Allowed for physical type: BYTE_ARRAY.
327+ //
328+ // See Geospatial.md for details.
329+ type GeometryType struct {
330+ CRS string `thrift:"1,optional"`
331+ }
332+
333+ func (t * GeometryType ) String () string {
334+ crs := t .CRS
335+ if crs == "" {
336+ crs = "OGC:CRS84"
337+ }
338+ return fmt .Sprintf ("GEOMETRY(%q)" , crs )
339+ }
340+
341+ // Embedded Geography logical type annotation
342+ //
343+ // Geospatial features in the WKB format with an explicit (non-linear/non-planar)
344+ // edges interpolation algorithm.
345+ //
346+ // A custom geographic CRS can be set by the crs field, where longitudes are
347+ // bound by [-180, 180] and latitudes are bound by [-90, 90]. If unset, the CRS
348+ // defaults to "OGC:CRS84".
349+ //
350+ // An optional algorithm can be set to correctly interpret edges interpolation
351+ // of the geometries. If unset, the algorithm defaults to SPHERICAL.
352+ //
353+ // Allowed for physical type: BYTE_ARRAY.
354+ //
355+ // See Geospatial.md for details.
356+ type GeographyType struct {
357+ CRS string `thrift:"1,optional"`
358+ Algorithm EdgeInterpolationAlgorithm `thrift:"2,optional"`
359+ }
360+
361+ func (t * GeographyType ) String () string {
362+ crs := t .CRS
363+ if crs == "" {
364+ crs = "OGC:CRS84"
365+ }
366+ return fmt .Sprintf ("GEOGRAPHY(%q, %s)" , crs , t .Algorithm )
367+ }
368+
268369// LogicalType annotations to replace ConvertedType.
269370//
270371// To maintain compatibility, implementations using LogicalType for a
@@ -287,13 +388,15 @@ type LogicalType struct { // union
287388 Timestamp * TimestampType `thrift:"8"`
288389
289390 // 9: reserved for Interval
290- Integer * IntType `thrift:"10"` // use ConvertedType Int* or Uint*
291- Unknown * NullType `thrift:"11"` // no compatible ConvertedType
292- Json * JsonType `thrift:"12"` // use ConvertedType JSON
293- Bson * BsonType `thrift:"13"` // use ConvertedType BSON
294- UUID * UUIDType `thrift:"14"` // no compatible ConvertedType
295- Float16 * Float16Type `thrift:"15"` // no compatible ConvertedType
296- Variant * VariantType `thrift:"16"` // no compatible ConvertedType
391+ Integer * IntType `thrift:"10"` // use ConvertedType Int* or Uint*
392+ Unknown * NullType `thrift:"11"` // no compatible ConvertedType
393+ Json * JsonType `thrift:"12"` // use ConvertedType JSON
394+ Bson * BsonType `thrift:"13"` // use ConvertedType BSON
395+ UUID * UUIDType `thrift:"14"` // no compatible ConvertedType
396+ Float16 * Float16Type `thrift:"15"` // no compatible ConvertedType
397+ Variant * VariantType `thrift:"16"` // no compatible ConvertedType
398+ Geometry * GeometryType `thrift:"17"` // no compatible ConvertedType
399+ Geography * GeographyType `thrift:"18"` // no compatible ConvertedType
297400}
298401
299402func (t * LogicalType ) String () string {
@@ -805,6 +908,9 @@ type ColumnMetaData struct {
805908 // also be useful in some cases for more fine-grained nullability/list length
806909 // filter pushdown.
807910 SizeStatistics * SizeStatistics `thrift:"16,optional"`
911+
912+ // Optional statistics specific for Geometry and Geography logical types
913+ GeospatialStatistics * GeospatialStatistics `thrift:"17,optional"`
808914}
809915
810916type EncryptionWithFooterKey struct {}
@@ -919,6 +1025,8 @@ type ColumnOrder struct { // union
9191025 // LIST - undefined
9201026 // MAP - undefined
9211027 // VARIANT - undefined
1028+ // GEOMETRY - undefined
1029+ // GEOGRAPHY - undefined
9221030 //
9231031 // In the absence of logical types, the sort order is determined by the physical type:
9241032 // BOOLEAN - false, true
0 commit comments