Implement complex join pushdown in JDBC connectors #19996
Conversation
31de58e to
bbdc659
Compare
bbdc659 to
ae7aaa0
Compare
|
Will unnest operation be covered in this PR? |
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/DefaultJdbcMetadata.java
Show resolved
Hide resolved
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/DefaultJdbcMetadata.java
Show resolved
Hide resolved
no, no plan for this. |
da7a572 to
bfbc2b2
Compare
|
(just rebased after #19998 merged. no other changes yet) |
bfbc2b2 to
75df2c9
Compare
|
(just rebased) |
7b863c2 to
75c7b08
Compare
|
PTAL |
wendigo
left a comment
There was a problem hiding this comment.
LGTM % some nits.
Great change Piotr!
...-base-jdbc/src/main/java/io/trino/plugin/jdbc/expression/RewriteCaseSensitiveComparison.java
Show resolved
Hide resolved
...-base-jdbc/src/main/java/io/trino/plugin/jdbc/expression/RewriteCaseSensitiveComparison.java
Show resolved
Hide resolved
...-base-jdbc/src/main/java/io/trino/plugin/jdbc/expression/RewriteCaseSensitiveComparison.java
Show resolved
Hide resolved
...-base-jdbc/src/main/java/io/trino/plugin/jdbc/expression/RewriteCaseSensitiveComparison.java
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/RewriteStringComparison.java
Show resolved
Hide resolved
plugin/trino-oracle/src/main/java/io/trino/plugin/oracle/RewriteStringComparison.java
Show resolved
Hide resolved
plugin/trino-postgresql/src/main/java/io/trino/plugin/postgresql/PostgreSqlClient.java
Show resolved
Hide resolved
f0b0a45 to
5683eee
Compare
|
(just rebased, no other changes) |
Implement non-deprecated `ConnectorMetadata.applyJoin` overload in `DefaultJdbcMetadata`. Thew old implementation is retained as a safety valve. The new implementation is not limited to the `List<JdbcJoinCondition>` model, so allows pushdown of joins involving more complex expressions, such as arithmetics. The `BaseJdbcClient.implementJoin` and `QueryBuilder.prepareJoinQuery` methods logically changed, but the old implementation is left as the fallback. These methods were extension points, so the old implementations are renamed to ensure implementors are updated. For example, if an implementation was overriding `BaseJdbcClient.implementJoin` it most likely wants to override the new `implementJoin` method as well, and this is reminded about by rename of the old method.
Restore older JDBC join pushdown implementation not based on `ConnectorExpression` as a fallback. This comes as a separate commit so that the introduction of `ConnectorExpression`-based join pushdown can be seen (e.g. reviewed) as a _change_, not as an _addition_.
5683eee to
4450dde
Compare
|
CI #20324 |
| "nation_lowercase", | ||
| "AS SELECT nationkey, lower(name) name, regionkey FROM nation")) { | ||
| for (JoinOperator joinOperator : JoinOperator.values()) { | ||
| log.info("Testing joinOperator=%s", joinOperator); |
There was a problem hiding this comment.
This pollutes the logs and makes it much harder to spot where the actual errors are happening. We're actually trying to reduce logging in tests. Please revert this.
There was a problem hiding this comment.
if there is a failure on CI, how do we know what failed?
There was a problem hiding this comment.
You can add a .describedAs(...) to the assertion containing the details of which join operator is being evaluated. That will be included in the failure message.
|
Does this need a release note? |
|
Thanks @findepi for this PR. I see tremendous improvements with JOIN pushdown in our custom connector (Trino-to-Trino, similar to Stargate from Starburst). We had multiple custom rules in our connector that are now working in tandem and many complex joins are now getting pushed down into the remote cluster. |
Implement non-deprecated
ConnectorMetadata.applyJoinoverload inDefaultJdbcMetadata. Thew old implementation is retained as a safetyvalve. The new implementation is not limited to the
List<JdbcJoinCondition>model, so allows pushdown of joins involvingmore complex expressions, such as arithmetics.