Skip to content

Conversation

@yuzefovich
Copy link
Member

Previously, we could panic when trying to construnct an inverted expression for a geo type. Such panics are not recovered from by the vectorized panic-catcher (since we haven't allow-listed the package), so it's better to propagate errors explicitly.

In particular, this allows us to prevent a crash when trying to evaluate st_dwithin-like functions with infinite distance (this hits an error in geos, so now we'll return an error, matching postgres).

Fixes: #151995.
Release note: None

Previously, we could panic when trying to construnct an inverted
expression for a geo type. Such panics are not recovered from by the
vectorized panic-catcher (since we haven't allow-listed the package), so
it's better to propagate errors explicitly.

In particular, this allows us to prevent a crash when trying to evaluate
`st_dwithin`-like functions with infinite distance (this hits an error
in geos, so now we'll return an error, matching postgres).

Release note: None
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@yuzefovich yuzefovich marked this pull request as ready for review October 7, 2025 15:55
@yuzefovich yuzefovich requested a review from a team as a code owner October 7, 2025 15:55
@yuzefovich yuzefovich requested review from mgartner and removed request for a team October 7, 2025 15:55
Copy link
Collaborator

@mgartner mgartner left a comment

Choose a reason for hiding this comment

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

:lgtm:

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


pkg/sql/opt/invertedidx/geo.go line 635 at r1 (raw file):

	invExpr, err := getSpanExpr(ctx, d, additionalParams, relationship, index.GeoConfig())
	if err != nil {
		return inverted.NonInvertedColExpression{}, nil

I wonder if the linter will like not returning the error here...

Copy link
Member Author

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

TFTR!

bors r+

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


pkg/sql/opt/invertedidx/geo.go line 635 at r1 (raw file):

Previously, mgartner (Marcus Gartner) wrote…

I wonder if the linter will like not returning the error here...

Looks like it's happy.

@craig
Copy link
Contributor

craig bot commented Oct 7, 2025

@craig craig bot merged commit 1b0d0ec into cockroachdb:master Oct 7, 2025
24 checks passed
@yuzefovich yuzefovich deleted the fix-geos-panic branch October 7, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

roachtest: geos error: IllegalArgumentException: BufferOp::getResultGeometry distance must be a finite value

3 participants