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

colexec: fix decimal/interval overload error propagation #58743

Merged
merged 1 commit into from
Jan 12, 2021

Conversation

yuzefovich
Copy link
Member

Fixes: #57773.

Release note (bug fix): CockroachDB could previously return an internal
error when evaluating a binary expression between a Decimal and an
Interval that required a cast to a Float when the value is out of range,
and now a more user-friendly error is returned instead.

@yuzefovich yuzefovich requested review from asubiotto and a team January 11, 2021 23:36
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Release note (bug fix): CockroachDB could previously return an internal
error when evaluating a binary expression between a Decimal and an
Interval that required a cast to a Float when the value is out of range,
and now a more user-friendly error is returned instead.
Copy link
Contributor

@asubiotto asubiotto left a comment

Choose a reason for hiding this comment

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

:lgtm: my remaining question is why the expression in the issue doesn't get folded?

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

@yuzefovich
Copy link
Member Author

I'm guessing it might have to do with the fact whether the table we're reading from is empty or not, but I'm not sure.

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 12, 2021

This PR was included in a batch that was canceled, it will be automatically retried

@craig
Copy link
Contributor

craig bot commented Jan 12, 2021

Build failed (retrying...):

@yuzefovich
Copy link
Member Author

Yeah, I think in the case when the table is empty, we have to not perform the constant folding:

[email protected]:26257/defaultdb> CREATE TABLE t (a INT);
CREATE TABLE

Time: 2ms total (execution 2ms / network 0ms)

[email protected]:26257/defaultdb> SELECT ((-1.234E+401)::DECIMAL * '-53 years -10 mons -377 days -08:33:40.519057'::INTERVAL::INTERVAL)::INTERVAL FROM t;
  interval
------------
(0 rows)

Time: 2ms total (execution 2ms / network 0ms)

[email protected]:26257/defaultdb> INSERT INTO t VALUES (NULL);
INSERT 1

Time: 1ms total (execution 0ms / network 0ms)

[email protected]:26257/defaultdb> SELECT ((-1.234E+401)::DECIMAL * '-53 years -10 mons -377 days -08:33:40.519057'::INTERVAL::INTERVAL)::INTERVAL FROM t;
ERROR: internal error: unexpected error from the vectorized engine: strconv.ParseFloat: parsing "-1.234E+401": value out of range
SQLSTATE: XX000
DETAIL: stack trace:
github.com/cockroachdb/cockroach/pkg/sql/colexecbase/colexecerror/error.go:90: func1()
...

@craig
Copy link
Contributor

craig bot commented Jan 12, 2021

Build succeeded:

@craig craig bot merged commit 158601d into cockroachdb:master Jan 12, 2021
@yuzefovich yuzefovich deleted the vec-proj branch January 12, 2021 20:10
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.

roachtest: sqlsmith ParseFloat value out of range
3 participants