Revanth14 commented on code in PR #1239:
URL: https://github.com/apache/iceberg-go/pull/1239#discussion_r3470983312
##########
table/arrow_utils.go:
##########
@@ -1883,23 +1923,32 @@ func geoArrowCRSToIcebergCRS(meta geoarrow.Metadata)
(string, error) {
if err := json.Unmarshal(meta.CRS, &crs); err != nil {
return "", fmt.Errorf("invalid geoarrow CRS metadata:
%w", err)
}
-
- if strings.EqualFold(crs, "OGC:CRS84") ||
strings.EqualFold(crs, "EPSG:4326") {
- return "OGC:CRS84", nil
+ if crs == "" {
+ return "", errors.New("unsupported CRS: empty string
CRS")
}
switch meta.CRSType {
- case geoarrow.CRSTypeSRID:
- return "srid:" + crs, nil
+ case geoarrow.CRSTypePROJJSON:
+ return "", errPROJJSONStringCRSNotSupported
case geoarrow.CRSTypeWKT22019:
- return "", errors.New("CRS type wkt2:2019 not
supported")
- default:
- if len(crs) <= 32 {
- return crs, nil
- }
+ return "", errWKT2CRSNotSupported
+ }
- return "", errors.New("crs length too long")
+ if strings.EqualFold(crs, "OGC:CRS84") ||
strings.EqualFold(crs, "EPSG:4326") {
+ return "OGC:CRS84", nil
+ }
+ if isWKT2CRSString(crs) {
+ return "", errWKT2CRSNotSupported
}
+ // SRID is resolved after the canonical and WKT2 checks so a
+ // contradictory crs_type=srid on a value like "EPSG:4326" still
+ // canonicalizes rather than producing "srid:EPSG:4326". Real
numeric
+ // SRIDs match none of the checks above and fall through to
here.
+ if meta.CRSType == geoarrow.CRSTypeSRID {
+ return "srid:" + crs, nil
+ }
+
+ return crs, nil
Review Comment:
Done. I added a short comment above the passthrough return explaining that
bare or unrecognized string CRS values are treated as opaque identifiers per
the Iceberg type contract and preserved for read/write compatibility.
--
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]