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

geomfn: implement validity operators #51484

Merged
merged 1 commit into from
Jul 17, 2020

Conversation

otan
Copy link
Contributor

@otan otan commented Jul 15, 2020

Unfortunately we cannot implement ST_IsValidDetail because it returns a
composite type, which we do not yet support.

Resolves #48960
Resolves #48961
Resolves #48963
Resolves #48964

Release note (sql change): Implements ST_IsValid, ST_IsValidReason and
ST_MakeValid operators for geometry types.

@otan otan requested review from rytaft and a team July 15, 2020 21:40
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@otan otan force-pushed the validity_checking branch 2 times, most recently from 340acf1 to dc09e28 Compare July 16, 2020 15:31
Copy link
Collaborator

@rytaft rytaft left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 8 of 8 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @otan)


pkg/geo/geomfn/validity_check.go, line 21 at r1 (raw file):

type ValidDetail struct {
	IsValid bool
	// Reason is only populated if IsValid = true.

shouldn't this be IsValid=false?


pkg/geo/geomfn/validity_check.go, line 23 at r1 (raw file):

	// Reason is only populated if IsValid = true.
	Reason string
	// InvalidLocation is only populated if IsValid = true.

ditto


pkg/geo/geos/geos.go, line 623 at r1 (raw file):

// means that self-intersecting rings forming holes are considered valid.
// It returns a bool representing whether it is valid, a string giving a reason for
// invalidity, an EWKB representing the location things are invalid at.

[nit] and an EWKB


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

			infoBuilder{
				info:         `Returns whether the geometry is valid as defined by the OGC spec.`,
				libraryUsage: usesGEOS,

Just out of curiosity: is this field purely for documentation purposes? Is there a way we could test that this matches reality? (Obviously that would be a different PR...)


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

			types.Geometry,
			infoBuilder{
				info:         "Returns a valid form of the given geometry.",

Do you need to mention the OGC spec here? Or not necessary?

Copy link
Contributor Author

@otan otan left a comment

Choose a reason for hiding this comment

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

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


pkg/geo/geomfn/validity_check.go, line 21 at r1 (raw file):

Previously, rytaft (Rebecca Taft) wrote…

shouldn't this be IsValid=false?

Done.


pkg/geo/geomfn/validity_check.go, line 23 at r1 (raw file):

Previously, rytaft (Rebecca Taft) wrote…

ditto

Done.


pkg/geo/geos/geos.go, line 623 at r1 (raw file):

Previously, rytaft (Rebecca Taft) wrote…

[nit] and an EWKB

Done.


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

Previously, rytaft (Rebecca Taft) wrote…

Just out of curiosity: is this field purely for documentation purposes? Is there a way we could test that this matches reality? (Obviously that would be a different PR...)

Yep - only docs.
Not sure about detection - requires some fancy go parsing i reckon.


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

Previously, rytaft (Rebecca Taft) wrote…

Do you need to mention the OGC spec here? Or not necessary?

Done.

Unfortunately we cannot implement ST_IsValidDetail because it returns a
composite type, which we do not yet support.

Release note (sql change): Implements ST_IsValid, ST_IsValidReason and
ST_MakeValid operators for geometry types.
@otan otan force-pushed the validity_checking branch from dc09e28 to 45c6cb4 Compare July 17, 2020 15:12
Copy link
Collaborator

@rytaft rytaft left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 4 files at r2.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained


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

Previously, otan (Oliver Tan) wrote…

Yep - only docs.
Not sure about detection - requires some fancy go parsing i reckon.

Sounds good -- probably not high priority

@otan
Copy link
Contributor Author

otan commented Jul 17, 2020

bors r=rytaft

@craig
Copy link
Contributor

craig bot commented Jul 17, 2020

Canceled (will resume)

@otan
Copy link
Contributor Author

otan commented Jul 17, 2020

bors r=rytaft

@craig
Copy link
Contributor

craig bot commented Jul 17, 2020

Build succeeded

@craig craig bot merged commit 7cb22cd into cockroachdb:master Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants