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

builtins: array builtins handle mismatched tuple types #70606

Merged
merged 2 commits into from
Sep 23, 2021

Conversation

rafiss
Copy link
Collaborator

@rafiss rafiss commented Sep 23, 2021

fixes #70481
fixes #70480
fixes #70479
fixes #70478
fixes #70477
fixes #70476

The first commit is a refactor to add a new CompareError method
to Datum. It propagates errors instead of panicking.

Since these builtins take in AnyTuple, the tuple contents aren't
type-checked. Instead, we must handle any errors that occur during tuple
comparison at execution-time. This matches the PostgresSQL behavior.

No release note since this bug was never released anywhere.

Release note: None

For some cases, we need to propogate the error and return it nicely for
the user. See next commit.

Release note: None
@rafiss rafiss requested review from otan and a team September 23, 2021 02:35
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@yuzefovich
Copy link
Member

Drive-by suggestion: maybe it would be simpler to add a panic-catcher specifically when comparing something with arrays?

Copy link
Contributor

@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.

i'm really hesitant on panic catchers and rather we catch em explicitly.
there have been cases (e.g. spatial) where i wanted an error with Compare but never bothered, might as well begin the pain of ripping off the bandaid...

up to rafi too though. the changes here lgtm :)

@rafiss
Copy link
Collaborator Author

rafiss commented Sep 23, 2021

tftr!

bors r=otan

@craig
Copy link
Contributor

craig bot commented Sep 23, 2021

Build failed:

@rafiss
Copy link
Collaborator Author

rafiss commented Sep 23, 2021

whoops i missed the github ci failure

Since these builtins take in AnyTuple, the tuple contents aren't
type-checked. Instead, we must handle any errors that occur during tuple
comparison at execution-time. This matches the PostgresSQL behavior.

No release note since this bug was never released anywhere.

Release note: None
@rafiss rafiss force-pushed the fix-array-tuple-compare branch from df40d43 to dda6518 Compare September 23, 2021 15:05
@rafiss
Copy link
Collaborator Author

rafiss commented Sep 23, 2021

bors r=otan

1 similar comment
@rafiss
Copy link
Collaborator Author

rafiss commented Sep 23, 2021

bors r=otan

@craig
Copy link
Contributor

craig bot commented Sep 23, 2021

Already running a review

@craig
Copy link
Contributor

craig bot commented Sep 23, 2021

Build succeeded:

@craig craig bot merged commit 55ef033 into cockroachdb:master Sep 23, 2021
@rafiss rafiss deleted the fix-array-tuple-compare branch September 24, 2021 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment