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

sql: do not distribute queries with subqueries returning OIDs #86186

Merged
merged 1 commit into from
Aug 23, 2022

Conversation

yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Aug 15, 2022

If a subquery results in a DOid datum, the datum will get a type
annotation (because DOids are ambiguous) when serializing the
render expression involving the result of the subquery. As a
result, we might need to perform a cast on a remote node which
might fail, thus we prohibit the distribution of the main query.

Fixes: #86075.

Release justification: bug fix.

Release note: None

@yuzefovich yuzefovich requested review from mgartner, cucaroach and a team August 15, 2022 22:52
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@yuzefovich yuzefovich requested a review from a team as a code owner August 16, 2022 21:17
@@ -273,6 +273,16 @@ func (v *distSQLExprCheckVisitor) VisitPre(expr tree.Expr) (recurse bool, newExp
case *tree.DOid:
v.err = newQueryNotSupportedError("OID expressions are not supported by distsql")
return false, expr
case *tree.Subquery:
if t.ResolvedType().Family() == types.OidFamily {
Copy link
Contributor

Choose a reason for hiding this comment

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

What if t is an array or tuple containing an OID?

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.

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


pkg/sql/distsql_physical_planner.go line 277 at r1 (raw file):

Previously, cucaroach (Tommy Reilly) wrote…

What if t is an array or tuple containing an OID?

Good point - it would still be a problem. Fixed.

If a subquery results in a DOid datum, the datum will get a type
annotation (because DOids are ambiguous) when serializing the
render expression involving the result of the subquery. As a
result, we might need to perform a cast on a remote node which
might fail, thus we prohibit the distribution of the main query.

Release justification: bug fix.

Release note: None
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.

Thanks!
:lgtm:

Reviewed 1 of 3 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @cucaroach)

@yuzefovich
Copy link
Member Author

TFTRs!

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 22, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 22, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 22, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 23, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 23, 2022

Build succeeded:

@craig craig bot merged commit cf533b0 into cockroachdb:master Aug 23, 2022
@yuzefovich yuzefovich deleted the subquery-doid branch August 23, 2022 13:29
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: ResolveFunctionByOID unimplemented
4 participants