From 835471a9691fd494d20a785edab794eae602d59b Mon Sep 17 00:00:00 2001 From: hantmac Date: Mon, 19 Aug 2024 20:34:10 +0800 Subject: [PATCH] add joinimpl --- .../trino/plugin/databend/DatabendClient.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/plugin/trino-databend/src/main/java/io/trino/plugin/databend/DatabendClient.java b/plugin/trino-databend/src/main/java/io/trino/plugin/databend/DatabendClient.java index 78e567bb3d5d02..28949833cdf2dd 100644 --- a/plugin/trino-databend/src/main/java/io/trino/plugin/databend/DatabendClient.java +++ b/plugin/trino-databend/src/main/java/io/trino/plugin/databend/DatabendClient.java @@ -38,6 +38,7 @@ import io.trino.plugin.jdbc.LongWriteFunction; import io.trino.plugin.jdbc.ObjectWriteFunction; import io.trino.plugin.jdbc.PredicatePushdownController; +import io.trino.plugin.jdbc.PreparedQuery; import io.trino.plugin.jdbc.QueryBuilder; import io.trino.plugin.jdbc.RemoteTableName; import io.trino.plugin.jdbc.StandardColumnMappings; @@ -60,6 +61,8 @@ import io.trino.spi.connector.ColumnMetadata; import io.trino.spi.connector.ConnectorSession; import io.trino.spi.connector.ConnectorTableMetadata; +import io.trino.spi.connector.JoinStatistics; +import io.trino.spi.connector.JoinType; import io.trino.spi.predicate.Domain; import io.trino.spi.type.CharType; import io.trino.spi.type.DecimalType; @@ -112,6 +115,7 @@ import static io.trino.plugin.jdbc.DecimalSessionSessionProperties.getDecimalRounding; import static io.trino.plugin.jdbc.DecimalSessionSessionProperties.getDecimalRoundingMode; import static io.trino.plugin.jdbc.JdbcErrorCode.JDBC_ERROR; +import static io.trino.plugin.jdbc.JdbcJoinPushdownUtil.implementJoinCostAware; import static io.trino.plugin.jdbc.JdbcMetadataSessionProperties.getDomainCompactionThreshold; import static io.trino.plugin.jdbc.PredicatePushdownController.DISABLE_PUSHDOWN; import static io.trino.plugin.jdbc.PredicatePushdownController.FULL_PUSHDOWN; @@ -260,6 +264,29 @@ public boolean isTopNGuaranteed(ConnectorSession session) return true; } + @Override + public Optional implementJoin( + ConnectorSession session, + JoinType joinType, + PreparedQuery leftSource, + Map leftProjections, + PreparedQuery rightSource, + Map rightProjections, + List joinConditions, + JoinStatistics statistics) + { + if (joinType == JoinType.FULL_OUTER) { + return Optional.empty(); + } + return implementJoinCostAware( + session, + joinType, + leftSource, + rightSource, + statistics, + () -> super.implementJoin(session, joinType, leftSource, leftProjections, rightSource, rightProjections, joinConditions, statistics)); + } + @Override public ResultSet getTables(Connection connection, Optional schemaName, Optional tableName) throws SQLException