Skip to content

geomfn: implement validity operators#51484

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
otan-cockroach:validity_checking
Jul 17, 2020
Merged

geomfn: implement validity operators#51484
craig[bot] merged 1 commit intocockroachdb:masterfrom
otan-cockroach:validity_checking

Conversation

@otan
Copy link
Copy Markdown
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 a team and rytaft July 15, 2020 21:40
@cockroach-teamcity
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

otan commented Jul 17, 2020

bors r=rytaft

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 17, 2020

Canceled (will resume)

@otan
Copy link
Copy Markdown
Contributor Author

otan commented Jul 17, 2020

bors r=rytaft

@craig
Copy link
Copy Markdown
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