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

geo: various geospatial built-in fixes #113781

Merged
merged 2 commits into from Nov 5, 2023

Conversation

rharding6373
Copy link
Collaborator

geo: support null input for geohash builtins

Allows and adds support for NULL inputs for the st_pointfromgeohash and
st_geomfromgeohash built-ins.

Epic: None
Informs: #111157

Release note (bug fix): Fixes null input handling for the geospatial
built-ins st_pointfromgeohash and st_geomfromgeohash.


geo: allow st_makeenvelope min/max bounds to be reversed

Postgis allows xmin/ymin to be greater than xmax/ymax respectively in
st_makeenvelope, but the geom library does not allow this when
converting Bounds to Polygon. Instead, we build the polygon explicitly
from the provided min/max coordinates.

Epic: None
Fixes: #111157

Release note (bug fix): The geospatial st_makeenvelope built-in now
correctly supports xmin or ymin to be greater than xmax or ymax,
respectively.

@rharding6373 rharding6373 requested review from a team and DrewKimball and removed request for a team November 3, 2023 20:16
@rharding6373 rharding6373 requested a review from a team as a code owner November 3, 2023 20:16
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@DrewKimball DrewKimball left a comment

Choose a reason for hiding this comment

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

:lgtm: Nice work!

Reviewed 2 of 2 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @rharding6373)


pkg/sql/sem/builtins/geo_builtins.go line 1133 at r1 (raw file):

			ReturnType: tree.FixedReturnType(types.Geometry),
			Fn: func(_ context.Context, evalCtx *eval.Context, args tree.Datums) (tree.Datum, error) {
				if tree.DNull.Compare(evalCtx, args[0]) == 0{

[nit] Elsewhere we just directly compare args with tree.DNull using ==. Did you find a case where that doesn't work?

Allows and adds support for NULL inputs for the st_pointfromgeohash and
st_geomfromgeohash built-ins.

Epic: None
Informs: cockroachdb#111157

Release note (bug fix): Fixes null input handling for the geospatial
built-ins st_pointfromgeohash and st_geomfromgeohash.
Postgis allows xmin/ymin to be greater than xmax/ymax respectively in
st_makeenvelope, but the geom library does not allow this when
converting Bounds to Polygon. Instead, we build the polygon explicitly
from the provided min/max coordinates.

Epic: None
Fixes: cockroachdb#111157

Release note (bug fix): The geospatial st_makeenvelope built-in now
correctly supports xmin or ymin to be greater than xmax or ymax,
respectively.
Copy link
Collaborator Author

@rharding6373 rharding6373 left a comment

Choose a reason for hiding this comment

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

TFTR!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @DrewKimball)


pkg/sql/sem/builtins/geo_builtins.go line 1133 at r1 (raw file):

Previously, DrewKimball (Drew Kimball) wrote…

[nit] Elsewhere we just directly compare args with tree.DNull using ==. Did you find a case where that doesn't work?

That's just how I happened to write it out. Thanks for the suggestion!

@rharding6373
Copy link
Collaborator Author

I created a new issue for the test failure, which is an unrelated randomized CDC test: #113842

@rharding6373
Copy link
Collaborator Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Nov 5, 2023

Build succeeded:

@craig craig bot merged commit 68d6832 into cockroachdb:master Nov 5, 2023
7 of 8 checks passed
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.

None yet

3 participants