-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Use fully qualified functions in planner and optimizer #19035
Conversation
356ab3c
to
452135e
Compare
core/trino-main/src/main/java/io/trino/sql/planner/ConnectorExpressionTranslator.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/metadata/ResolvedFunction.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/metadata/ResolvedFunction.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/operator/annotations/ImplementationDependency.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/operator/scalar/FormatFunction.java
Outdated
Show resolved
Hide resolved
return FunctionCallBuilder.resolve(session, metadata) | ||
.setName(QualifiedName.of(nullAllowed ? NullableFunction.NAME : Function.NAME)) | ||
return BuiltinFunctionCallBuilder.resolve(metadata) | ||
.setName(nullAllowed ? NullableFunction.NAME : Function.NAME) |
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.
We should rename Function
to DynamicFilterFunction
core/trino-main/src/main/java/io/trino/sql/planner/iterative/rule/ExtractSpatialJoins.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/metadata/MetadataManager.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/metadata/ResolvedFunction.java
Outdated
Show resolved
Hide resolved
@@ -45,7 +69,10 @@ public void testPruneOneChild() | |||
p.values(a, unused), | |||
p.values(b, r), | |||
ImmutableList.of(a, b, r), | |||
expression("ST_Distance(a, b) <= r")); |
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.
Can we handle this by adding a rewriteFunctionCall
to io.trino.sql.ExpressionUtils#rewriteIdentifiersToSymbolReferences
?
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.
It is possible, but after talking with Martin he wants to move away from this method. This change sets up the code for the new IR.
Use TranslationMap to apply casts, desugar expression, and preform other rewrites in evaluateConstantExpression
Move CatalogSchemaFunctionName to SPI and add to BoundSignature
Operators and coercions must be global functions
Most uses of resolve function in analyzer and optimizers are hard coded to lookup builtin functions, and these can use the simpler resolveBuiltin method that does not need a session. Split FunctionCallBuilder into BuiltinFunctionCallBuilder for building new function call nodes for builtin functions, and ResolvedFunctionCallBuilder for building a function call node for previously resolved function.
452135e
to
503fd2a
Compare
Description
This PR changes the planner and optimizer to consistenly handle fully qualified function names. To reduce the burden on this code this PR adds a simplified method to resolve builtin functions. This new function uses a simple string function name, and removes the need for a session, as session was only need for PATH.
Release notes
(x) This is not user-visible or is docs only, and no release notes are required.