Skip to content

fix(go): address issues in geo implementation#144

Merged
lidavidm merged 4 commits into
mainfrom
dev
Jun 3, 2026
Merged

fix(go): address issues in geo implementation#144
lidavidm merged 4 commits into
mainfrom
dev

Conversation

@lidavidm
Copy link
Copy Markdown
Contributor

@lidavidm lidavidm commented Jun 2, 2026

No description provided.

@lidavidm
Copy link
Copy Markdown
Contributor Author

lidavidm commented Jun 2, 2026

@paleolimbot does this look more reasonable?

Copy link
Copy Markdown
Contributor

@paleolimbot paleolimbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This is great...I am picky about these things but this is much better and I can file a follow up if you'd prefer to move on 🙂

Comment thread go/statement.go
Comment on lines 730 to 737
if err := json.Unmarshal(meta.CRS, &crsStr); err == nil {
if strings.HasPrefix(crsStr, "EPSG:") {
if code, err := strconv.Atoi(crsStr[5:]); err == nil {
return code
return code, meta.Edges
}
}
return 0
return 0, meta.Edges
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other one that will show up here that is identical to "EPSG:4326" is "OGC:CRS84" (I wish this weren't true for what it's worth 😬 ). You can return an SRID of 4326 for this case.

Comment thread go/statement.go
Comment on lines 740 to 744
if err := json.Unmarshal(meta.CRS, &crs); err == nil {
if strings.EqualFold(crs.ID.Authority, "EPSG") && crs.ID.Code != 0 {
return crs.ID.Code
return crs.ID.Code, meta.Edges
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other one that will show up here is {"authority":"OGC","code":"CRS84"}. In Arrow C++ we also handle {"authority":"EPSG","code":"4326"} (where 4326 is a string) but I've never seen that in the wild.

Comment thread go/statement.go Outdated
Comment on lines +687 to +690
if srid == 4326 && edges == "spherical" {
return "geography"
}
return "geography"
return "geometry"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a geospatial snob and so I probably would do:

    if srid == 4326 && edges == "spherical" {
		return "geography"
	} else if srid == 4326 && edges == "spherical" {
        // error: force user-specified spatial type from the option because snowflake geography
        // only supports SRID 4326, so both geography and geometry are incorrect in different ways
    } else {
        return "geometry"
    }

...but your way is fine for all practical purposes (as long as you handle OGC:CRS84 below).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I adjusted this and added more tests!

@lidavidm lidavidm marked this pull request as ready for review June 3, 2026 06:41
@lidavidm lidavidm requested a review from zeroshade as a code owner June 3, 2026 06:41
Copy link
Copy Markdown
Contributor

@paleolimbot paleolimbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@lidavidm lidavidm merged commit 589ac37 into main Jun 3, 2026
2 of 8 checks passed
@lidavidm lidavidm deleted the dev branch June 3, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants