Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import io.trino.spi.connector.ConnectorTableMetadata;
import io.trino.spi.connector.SchemaNotFoundException;
import io.trino.spi.connector.SchemaTableName;
import io.trino.spi.expression.ConnectorExpression;
import io.trino.spi.type.CharType;
import io.trino.spi.type.DateType;
import io.trino.spi.type.DecimalType;
Expand Down Expand Up @@ -142,6 +143,7 @@ public class IgniteClient
private static final LocalDate MIN_DATE = LocalDate.parse("1970-01-01");
private static final LocalDate MAX_DATE = LocalDate.parse("9999-12-31");

private final ConnectorExpressionRewriter<String> connectorExpressionRewriter;
private final AggregateFunctionRewriter<JdbcExpression, String> aggregateFunctionRewriter;

@Inject
Expand All @@ -155,8 +157,10 @@ public IgniteClient(
super(config, "`", connectionFactory, queryBuilder, identifierMapping, queryModifier);

JdbcTypeHandle bigintTypeHandle = new JdbcTypeHandle(Types.BIGINT, Optional.of("bigint"), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
ConnectorExpressionRewriter<String> connectorExpressionRewriter = JdbcConnectorExpressionRewriterBuilder.newBuilder()
this.connectorExpressionRewriter = JdbcConnectorExpressionRewriterBuilder.newBuilder()
.addStandardRules(this::quoted)
.map("$like(value: varchar, pattern: varchar): boolean").to("value LIKE pattern")
.map("$like(value: varchar, pattern: varchar, escape: varchar(1)): boolean").to("value LIKE pattern ESCAPE escape")
.build();
this.aggregateFunctionRewriter = new AggregateFunctionRewriter<>(
connectorExpressionRewriter,
Expand Down Expand Up @@ -305,6 +309,12 @@ public Optional<JdbcExpression> implementAggregation(ConnectorSession session, A
return aggregateFunctionRewriter.rewrite(session, aggregate, assignments);
}

@Override
public Optional<String> convertPredicate(ConnectorSession session, ConnectorExpression expression, Map<String, ColumnHandle> assignments)
{
return connectorExpressionRewriter.rewrite(session, expression, assignments);
}

private static Optional<JdbcTypeHandle> toTypeHandle(DecimalType decimalType)
{
return Optional.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
case SUPPORTS_NEGATIVE_DATE:
return false;

case SUPPORTS_PREDICATE_EXPRESSION_PUSHDOWN_WITH_LIKE:
case SUPPORTS_AGGREGATION_PUSHDOWN_COUNT_DISTINCT:
case SUPPORTS_DROP_COLUMN:
case SUPPORTS_LIMIT_PUSHDOWN:
Expand Down