Refactor ConnectorTableFunction into interface#12531
Conversation
There was a problem hiding this comment.
this should be final, per https://github.com/trinodb/trino/blob/master/.github/DEVELOPMENT.md#additional-ide-configuration
However, this should also be package-private, we don't want to make this part of SPI's contract.
Since this is used shared between io.trino.spi.ptf and io.trino.spi it cannot be package-private.
Please add this as a package-private utility class in io.trino.spi.ptf package, and use it only there.
Revert io.trino.spi.procedure changes.
There was a problem hiding this comment.
This should say that AbstractConnectorTableFunction is helpful.
We shouldn't require extending from the class. The interface is the contract.
When thinking more about this, I am thinking what are these checks that AbstractConnectorTableFunction does. What would happen if a connector implemented the interface directly. Maybe the checks should be moved to TableFunctionRegistry?
There was a problem hiding this comment.
I think that AbstractConnectorTableFunction is helpful because it provides the constructor.
However, it is probably a must to move the checks to the registry in case someone implements the interface directly.
There was a problem hiding this comment.
let's do this. to avoid duplicated logic, let's remove them from AbstractConnectorTableFunction.
There was a problem hiding this comment.
Yeah, I'm going to leave only rnn there, and do the full validation in the registry.
5d8a279 to
8805581
Compare
|
@findepi PTAL |
Introduce an abstract class as base for implementations
8805581 to
4a7d72a
Compare
This change refactors
ConnectorTableFunctionfrom abstract class into interface. It also adds an abstract classAbstractConnectorTableFunction, which is meant to be base for all implementations ofConnectorTableFunction.This is a SPI change.
Related to: #12325 (comment) (an interface is needed to apply a class-loader-safe wrapper)
Docs change included.