-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
opt: build UDF expressions #84723
opt: build UDF expressions #84723
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1, 6 of 6 files at r2, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @mgartner and @michae2)
pkg/sql/opt/norm/decorrelate_funcs.go
line 67 at r2 (raw file):
case *memo.UserDefinedFunctionExpr: // Do not attempt to hoist UDFs.
Is this a limitation we'll be able to lift at some point?
pkg/sql/opt/optbuilder/scalar.go
line 605 at r2 (raw file):
// A statement inside a UDF body cannot refer to anything from the outer // expression calling the function, so we use an empty scope. // TODO(mgartner): We may need ot set bodyScope.atRoot=true to prevent CTEs
nit: ot -> to
There was a problem hiding this 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: complete! 1 of 0 LGTMs obtained (waiting on @michae2 and @rytaft)
pkg/sql/opt/norm/decorrelate_funcs.go
line 67 at r2 (raw file):
Previously, rytaft (Rebecca Taft) wrote…
Is this a limitation we'll be able to lift at some point?
Yes, we'll want to inline UDFs when possible. I'm not positive yet whether that transformation will be part of these hoist-related rules or separate, but the goal of the transformation is similar.
pkg/sql/opt/optbuilder/scalar.go
line 605 at r2 (raw file):
Previously, rytaft (Rebecca Taft) wrote…
nit: ot -> to
Done.
Build failed: |
bors r- |
bors r+ |
Build failed: |
`OptTester` now sets its `SemaContext`'s `SearchPath` to `EmptySearchPath`, instead of `nil`, to avoid nil pointer exceptions when resolving unknown functions. Release note: None
This commit adds basic support for building UDFs in optbuilder. Only scalar, nullary (arity of zero) functions with a single statement in the body are supported. Support for more types of UDFs will follow in future commits. Note that this commit does not add support for execution of UDFs, only building them within an optimizer expression. Release note: None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1, 6 of 6 files at r4, 6 of 6 files at r5, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @rytaft)
bors r+ |
Build succeeded: |
opt: set opt tester search path to empty
OptTester
now sets itsSemaContext
'sSearchPath
toEmptySearchPath
, instead ofnil
, to avoid nil pointer exceptionswhen resolving unknown functions.
Release note: None
opt: build UDF expressions
This commit adds basic support for building UDFs in optbuilder. Only
scalar, nullary (arity of zero) functions with a single statement in the
body are supported. Support for more types of UDFs will follow in future
commits. Note that this commit does not add support for execution of
UDFs, only building them within an optimizer expression.
Release note: None