Skip to content
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

[ADH-5332]: Implement support of pushdown functions predicates #5

Open
wants to merge 6 commits into
base: feature/ADH-5241
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions plugin/trino-adb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-context</artifactId>
</exclusion>
<exclusion>
<groupId>io.trino</groupId>
<artifactId>trino-matching</artifactId>
</exclusion>
<exclusion>
<groupId>io.trino</groupId>
<artifactId>trino-plugin-toolkit</artifactId>
Expand All @@ -150,6 +154,12 @@
</exclusions>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-matching</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-plugin-toolkit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import io.airlift.configuration.Config;
import io.airlift.configuration.ConfigDescription;
import io.airlift.configuration.LegacyConfig;
import io.airlift.units.DataSize;
import io.airlift.units.Duration;
import io.airlift.units.MinDataSize;
Expand All @@ -33,6 +34,7 @@ public class AdbPluginConfig
private DataSize readBufferSize = DataSize.of(64L, DataSize.Unit.MEGABYTE);
private final TransferDataProtocol dataProtocol = TransferDataProtocol.GPFDIST;
private Duration gpfdistRetryTimeout;
private boolean enableStringPushdownWithCollate;

public TransferDataProtocol getDataProtocol()
{
Expand Down Expand Up @@ -64,6 +66,19 @@ public AdbPluginConfig setArrayMapping(AdbPluginConfig.ArrayMapping arrayMapping
return this;
}

public boolean isEnableStringPushdownWithCollate()
{
return this.enableStringPushdownWithCollate;
}

@Config("adb.enable-string-pushdown-with-collate")
@LegacyConfig("adb.experimental.enable-string-pushdown-with-collate")
public AdbPluginConfig setEnableStringPushdownWithCollate(boolean enableStringPushdownWithCollate)
{
this.enableStringPushdownWithCollate = enableStringPushdownWithCollate;
return this;
}

public boolean isIncludeSystemTables()
{
return this.includeSystemTables;
Expand Down Expand Up @@ -125,7 +140,7 @@ public Duration getGpfdistRetryTimeout()
return this.gpfdistRetryTimeout;
}

@Config("adb.gpfdist.retry-timeout")
@Config("adb.connector.gpfdist.retry-timeout")
@ConfigDescription("Value of adb gpfdist_retry_timeout property. Defaults to null (use adb defaults)")
public AdbPluginConfig setGpfdistRetryTimeout(Duration gpfdistRetryTimeout)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import io.trino.plugin.adb.connector.metadata.impl.AdbMetadataDaoImpl;
import io.trino.plugin.adb.connector.protocol.TransferDataProtocol;
import io.trino.plugin.adb.connector.protocol.gpfdist.GpfdistModule;
import io.trino.plugin.adb.connector.query.CollationAwareQueryBuilder;
import io.trino.plugin.adb.connector.table.AdbCreateTableStorageConfig;
import io.trino.plugin.adb.connector.table.AdbTableProperties;
import io.trino.plugin.adb.connector.table.SplitSourceManager;
Expand Down Expand Up @@ -58,9 +59,12 @@ protected void setup(Binder binder)
ConfigBinder.configBinder(binder).bindConfig(AdbCreateTableStorageConfig.class);
ConfigBinder.configBinder(binder).bindConfig(JdbcStatisticsConfig.class);
JdbcModule.bindSessionPropertiesProvider(binder, AdbSessionProperties.class);
JdbcModule.bindSessionPropertiesProvider(binder, AdbPushdownSessionProperties.class);
JdbcModule.bindTablePropertiesProvider(binder, AdbTableProperties.class);
OptionalBinder.newOptionalBinder(binder, QueryBuilder.class).setBinding().to(CollationAwareQueryBuilder.class).in(Scopes.SINGLETON);
Multibinder.newSetBinder(binder, ConnectorTableFunction.class).addBinding().toProvider(Query.class).in(Scopes.SINGLETON);
OptionalBinder.newOptionalBinder(binder, QueryBuilder.class).setBinding().to(CollationAwareQueryBuilder.class)
.in(Scopes.SINGLETON);
Multibinder.newSetBinder(binder, ConnectorTableFunction.class).addBinding().toProvider(Query.class)
.in(Scopes.SINGLETON);
AdbPluginConfig pluginConfig = this.buildConfigObject(AdbPluginConfig.class);

install(new DataFormatModule());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.trino.plugin.adb.connector;

import io.airlift.configuration.Config;
import io.airlift.configuration.ConfigDescription;

public class AdbPushdownConfig
{
private boolean pushdownLiterals = true;
private boolean pushdownDecimalArithmetics = true;
private boolean pushdownDoubleArithmetics = true;
private boolean pushdownDatetimeArithmetics = true;
private boolean pushdownDatetimeComparison = true;
private boolean pushdownFunctionCast = true;
private boolean pushdownFunctionDatePart = true;
private boolean pushdownFunctionLike = true;
private boolean pushdownFunctionSubstring = true;
private boolean pushdownFunctionUpper = true;
private boolean pushdownFunctionLower = true;

public boolean isPushdownLiterals()
{
return this.pushdownLiterals;
}

@Config("adb.pushdown.literals")
@ConfigDescription("Whether to pushdown BOOLEAN, CHAR, REAL and DOUBLE literals, as well as literals with NULL values")
public AdbPushdownConfig setPushdownLiterals(boolean pushdownLiterals)
{
this.pushdownLiterals = pushdownLiterals;
return this;
}

public boolean isPushdownDecimalArithmetics()
{
return this.pushdownDecimalArithmetics;
}

@Config("adb.pushdown.decimal-arithmetics")
@ConfigDescription("Whether to pushdown arithmetical operations on DECIMAL data type")
public AdbPushdownConfig setPushdownDecimalArithmetics(boolean pushdownDecimalArithmetics)
{
this.pushdownDecimalArithmetics = pushdownDecimalArithmetics;
return this;
}

public boolean isPushdownDoubleArithmetics()
{
return this.pushdownDoubleArithmetics;
}

@Config("adb.pushdown.double-arithmetics")
@ConfigDescription("Whether to pushdown arithmetical operations on REAL and DOUBLE data types")
public AdbPushdownConfig setPushdownDoubleArithmetics(boolean pushdownDoubleArithmetics)
{
this.pushdownDoubleArithmetics = pushdownDoubleArithmetics;
return this;
}

public boolean isPushdownDatetimeArithmetics()
{
return this.pushdownDatetimeArithmetics;
}

@Config("adb.pushdown.datetime-arithmetics")
@ConfigDescription("Whether to pushdown arithmetical operations on date/time data types")
public AdbPushdownConfig setPushdownDatetimeArithmetics(boolean pushdownDatetimeArithmetics)
{
this.pushdownDatetimeArithmetics = pushdownDatetimeArithmetics;
return this;
}

public boolean isPushdownDatetimeComparison()
{
return this.pushdownDatetimeComparison;
}

@Config("adb.pushdown.datetime-comparison")
@ConfigDescription("Whether to pushdown comparison operations on date/time data types")
public AdbPushdownConfig setPushdownDatetimeComparison(boolean pushdownDatetimeComparison)
{
this.pushdownDatetimeComparison = pushdownDatetimeComparison;
return this;
}

public boolean isPushdownFunctionCast()
{
return this.pushdownFunctionCast;
}

@Config("adb.pushdown.function.cast")
@ConfigDescription("Whether to pushdown CAST function")
public AdbPushdownConfig setPushdownFunctionCast(boolean pushdownFunctionCast)
{
this.pushdownFunctionCast = pushdownFunctionCast;
return this;
}

public boolean isPushdownFunctionDatePart()
{
return this.pushdownFunctionDatePart;
}

@Config("adb.pushdown.function.date-part")
@ConfigDescription("Whether to pushdown DATE_PART functions")
public AdbPushdownConfig setPushdownFunctionDatePart(boolean pushdownFunctionDatePart)
{
this.pushdownFunctionDatePart = pushdownFunctionDatePart;
return this;
}

public boolean isPushdownFunctionLike()
{
return this.pushdownFunctionLike;
}

@Config("adb.pushdown.function.like")
@ConfigDescription("Whether to pushdown LIKE function")
public AdbPushdownConfig setPushdownFunctionLike(boolean pushdownFunctionLike)
{
this.pushdownFunctionLike = pushdownFunctionLike;
return this;
}

public boolean isPushdownFunctionSubstring()
{
return this.pushdownFunctionSubstring;
}

@Config("adb.pushdown.function.substring")
@ConfigDescription("Whether to pushdown SUBSTRING function")
public AdbPushdownConfig setPushdownFunctionSubstring(boolean pushdownFunctionSubstring)
{
this.pushdownFunctionSubstring = pushdownFunctionSubstring;
return this;
}

public boolean isPushdownFunctionUpper()
{
return this.pushdownFunctionUpper;
}

@Config("adb.pushdown.function.upper")
@ConfigDescription("Whether to pushdown UPPER function")
public AdbPushdownConfig setPushdownFunctionUpper(boolean pushdownFunctionUpper)
{
this.pushdownFunctionUpper = pushdownFunctionUpper;
return this;
}

public boolean isPushdownFunctionLower()
{
return this.pushdownFunctionLower;
}

@Config("adb.pushdown.function.lower")
@ConfigDescription("Whether to pushdown LOWER function")
public AdbPushdownConfig setPushdownFunctionLower(boolean pushdownFunctionLower)
{
this.pushdownFunctionLower = pushdownFunctionLower;
return this;
}
}
Loading
Loading