Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql, geo: Fix upper case geohash parsing and allow NULL arguments #76990

Merged
merged 1 commit into from
Feb 25, 2022

Conversation

RichardJCai
Copy link
Contributor

@RichardJCai RichardJCai commented Feb 24, 2022

Release note (sql change): ST_Box2DFromGeoHash now accepts NULL arguments,
the precision being NULL is the same as no precision being passed in at all.

Upper case characters are now parsed as lower case characters for geohash,
this matches Postgis behaviour.

Resolves #75537

@RichardJCai RichardJCai requested review from rafiss, otan and a team February 24, 2022 17:44
@cockroach-teamcity
Copy link
Member

This change is Reviewable

pkg/geo/parse.go Outdated
@@ -239,6 +239,9 @@ func parseGeoHash(g string, precision int) (geohash.Box, error) {
return geohash.Box{}, pgerror.Newf(pgcode.InvalidParameterValue, "length of GeoHash must be greater than 0")
}

// In PostGis, upper case letters are parsed as lower case letters.
Copy link
Contributor

@otan otan Feb 24, 2022

Choose a reason for hiding this comment

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

(here and the test below)

nit: capitalise PostGIS as PostGIS
maybe use the term "case insensitive"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@RichardJCai RichardJCai force-pushed the fix_st_box2dfromgeohash branch from 39fd966 to 8c610ca Compare February 24, 2022 20:57
@@ -642,6 +642,17 @@ func TestParseHash(t *testing.T) {
Max: -120.9375,
},
}},
// In PostGIS, upper case characters are parsed as lower case characters.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: use term "case sensitive"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

case-insensitive right? updated.

Release note (sql change): ST_Box2DFromGeoHash now accepts NULL arguments,
the precision being NULL is the same as no precision being passed in at all.

Upper case characters are now parsed as lower case characters for geohash,
this matches Postgis behaviour.
@RichardJCai RichardJCai force-pushed the fix_st_box2dfromgeohash branch from 8c610ca to 537f89d Compare February 25, 2022 16:24
@RichardJCai
Copy link
Contributor Author

Thanks!
bors r=otan

@craig craig bot merged commit 2826900 into cockroachdb:master Feb 25, 2022
@craig
Copy link
Contributor

craig bot commented Feb 25, 2022

Build succeeded:

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.

spatial: difference in st_box2dfromgeohash result
3 participants