happydave1 commented on code in PR #1138:
URL: https://github.com/apache/iceberg-go/pull/1138#discussion_r3394344969


##########
table/arrow_utils.go:
##########
@@ -658,20 +672,26 @@ func (c convertToArrow) VisitVariant() arrow.Field {
        return arrow.Field{Type: extensions.NewDefaultVariantType()}
 }
 
-func (c convertToArrow) VisitGeometry(iceberg.GeometryType) arrow.Field {
+func (c convertToArrow) VisitGeometry(g iceberg.GeometryType) arrow.Field {
+       meta := icebergCRSToGeoArrowMetadata(g.CRS())
        if c.useLargeTypes {
-               return arrow.Field{Type: 
geoarrow.NewWKBType(geoarrow.WKBWithLargeBinaryStorage())}
+               return arrow.Field{Type: 
geoarrow.NewWKBType(geoarrow.WKBWithLargeBinaryStorage(), 
geoarrow.WKBWithMetadata(meta))}
        }
 
-       return arrow.Field{Type: 
geoarrow.NewWKBType(geoarrow.WKBWithBinaryStorage())}
+       return arrow.Field{Type: 
geoarrow.NewWKBType(geoarrow.WKBWithBinaryStorage(), 
geoarrow.WKBWithMetadata(meta))}
 }
 
-func (c convertToArrow) VisitGeography(iceberg.GeographyType) arrow.Field {
+func (c convertToArrow) VisitGeography(g iceberg.GeographyType) arrow.Field {
+       meta := icebergCRSToGeoArrowMetadata(g.CRS())
+       // Always add an edge to differentiate between Geography and Geometry 
arrow fields.
+       // Note that the edge convention is a best-effort hint and planar 
geography from other clients won't round-trip through Arrow alone.
+       meta.Edges = geoarrow.EdgeInterpolation(g.Algorithm())

Review Comment:
   PyIceberg supports planar geography (see 
https://github.com/apache/iceberg-python/blob/main/mkdocs/docs/geospatial.md) 
   
   But I agree, planar geography should not be supported as per the Iceberg 
spec (https://iceberg.apache.org/spec/#edge-interpolation-algorithm)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to