-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Simplify adding table functions #18660
Simplify adding table functions #18660
Conversation
5397b92
to
2a2a6aa
Compare
nit: typo in cmt msg Simlify -> Simplify |
core/trino-main/src/main/java/io/trino/metadata/GlobalFunctionCatalog.java
Outdated
Show resolved
Hide resolved
24bc132
to
3871173
Compare
core/trino-main/src/main/java/io/trino/metadata/TableFunctionProcessorProviderFactory.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/metadata/TableFunctionProcessorProviderFactory.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/metadata/TableFunctionProcessorProviderFactory.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/metadata/TableFunctionProcessorProviderFactory.java
Outdated
Show resolved
Hide resolved
import io.trino.spi.function.table.ConnectorTableFunctionHandle; | ||
import io.trino.spi.function.table.TableFunctionProcessorProvider; | ||
|
||
public interface TableFunctionProcessorProviderFactory |
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.
Should this and ConnectorSplitSourceFactory be one interface?
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.
moved to single TableFunctionFeaturesFactory
interface,
but I am not sure about the name
core/trino-main/src/main/java/io/trino/operator/table/ExcludeColumns.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/operator/table/Sequence.java
Outdated
Show resolved
Hide resolved
3871173
to
47ca30c
Compare
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.
I like this refactor.
core/trino-main/src/main/java/io/trino/metadata/TableFunctionFeaturesFactory.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/connector/system/GlobalSystemConnector.java
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/connector/system/GlobalSystemConnector.java
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/connector/system/GlobalSystemConnector.java
Show resolved
Hide resolved
e374de0
to
b2b2f64
Compare
core/trino-main/src/main/java/io/trino/connector/system/GlobalSystemConnector.java
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/metadata/TableFunctionProvider.java
Outdated
Show resolved
Hide resolved
Is this still a draft? |
b2b2f64
to
743f4d7
Compare
|
||
@Inject | ||
public GlobalSystemConnector(Set<SystemTable> systemTables, Set<Procedure> procedures, Set<ConnectorTableFunction> tableFunctions) | ||
public GlobalSystemConnector(Set<SystemTable> systemTables, Set<Procedure> procedures, Set<ConnectorTableFunction> tableFunctions, Set<TableFunctionProvider> tableFunctionProviders) |
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.
nit: Can we swap the arguments ?
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.
Are we going to replace the tableFunctions
to tableFunctionProvider
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.
I think no.
The problem is with naming.
TableFunctionProvider
- it's kind of interface, which is needed in some rare cases for functions like Sequence
and Exclude Columns.
For this functions we need some additional functionality like TableFunctionProcessorProvider
and ConnectorSplitSource
. But for all other cases we don need them.
core/trino-main/src/main/java/io/trino/connector/system/GlobalSystemConnector.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/connector/system/SystemConnectorModule.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/metadata/GlobalFunctionCatalog.java
Outdated
Show resolved
Hide resolved
to simplify adding table functions, we are not tightly coupled with concrete table connector function implementations in GlobalSystemConnector and GlobalFunctionCatalog now.
743f4d7
to
ef99a66
Compare
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.
What's the motivation for this change?
Except for a controlled set of functions, table functions should be provided via connectors and mounted under a catalog/schema namespace. This seems to generalize the mechanism for adding functions to the global catalog, which is the opposite of the direction we're trying to go in (see #8)
|
||
throw new UnsupportedOperationException(); | ||
checkArgument(tableFunctionAdditionalFeatures.size() <= 1, "we should have only one implementation for concrete function handle or nothing"); |
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.
This should be a TrinoException with FUNCTION_IMPLEMENTATION_ERROR
error code. Also, rephrase as "multiple implementations found for a function handle".
The goal is to simplify the registration of a function which is closer to the engine like if we are having a different table function like Is there is any other approaches we could take to simplify the table function registration. |
As I described above, we should avoid adding functions in the global namespace and, instead, implement them via connectors that get mounted in a catalog/schema. It's very likely that in the future we'll move those existing functions to a connector. |
This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua |
@vlad-lyutenko I assume you are still continuing on this work. If not, please close the PR. |
Description
Additional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: