Search in sources :

Example 1 with JdbcTableHandle

use of io.trino.plugin.jdbc.JdbcTableHandle in project trino by trinodb.

the class DruidJdbcClient method prepareTableHandleForQuery.

private JdbcTableHandle prepareTableHandleForQuery(JdbcTableHandle table) {
    if (table.isNamedRelation()) {
        String schemaName = table.getSchemaName();
        checkArgument("druid".equals(schemaName), "Only \"druid\" schema is supported");
        table = new JdbcTableHandle(new JdbcNamedRelationHandle(table.getRequiredNamedRelation().getSchemaTableName(), // Druid doesn't like table names to be qualified with catalog names in the SQL query, hence we null out the catalog.
        new RemoteTableName(Optional.empty(), table.getRequiredNamedRelation().getRemoteTableName().getSchemaName(), table.getRequiredNamedRelation().getRemoteTableName().getTableName()), Optional.empty()), table.getConstraint(), table.getConstraintExpressions(), table.getSortOrder(), table.getLimit(), table.getColumns(), table.getOtherReferencedTables(), table.getNextSyntheticColumnId());
    }
    return table;
}
Also used : JdbcNamedRelationHandle(io.trino.plugin.jdbc.JdbcNamedRelationHandle) JdbcTableHandle(io.trino.plugin.jdbc.JdbcTableHandle) RemoteTableName(io.trino.plugin.jdbc.RemoteTableName)

Example 2 with JdbcTableHandle

use of io.trino.plugin.jdbc.JdbcTableHandle in project trino by trinodb.

the class PhoenixMetadata method beginInsert.

@Override
public ConnectorInsertTableHandle beginInsert(ConnectorSession session, ConnectorTableHandle tableHandle, List<ColumnHandle> columns) {
    JdbcTableHandle handle = (JdbcTableHandle) tableHandle;
    Optional<String> rowkeyColumn = phoenixClient.getColumns(session, handle).stream().map(JdbcColumnHandle::getColumnName).filter(ROWKEY::equalsIgnoreCase).findFirst();
    List<JdbcColumnHandle> columnHandles = columns.stream().map(JdbcColumnHandle.class::cast).collect(toImmutableList());
    return new PhoenixOutputTableHandle(handle.getSchemaName(), handle.getTableName(), columnHandles.stream().map(JdbcColumnHandle::getColumnName).collect(toImmutableList()), columnHandles.stream().map(JdbcColumnHandle::getColumnType).collect(toImmutableList()), Optional.of(columnHandles.stream().map(JdbcColumnHandle::getJdbcTypeHandle).collect(toImmutableList())), rowkeyColumn);
}
Also used : JdbcColumnHandle(io.trino.plugin.jdbc.JdbcColumnHandle) JdbcTableHandle(io.trino.plugin.jdbc.JdbcTableHandle)

Example 3 with JdbcTableHandle

use of io.trino.plugin.jdbc.JdbcTableHandle in project trino by trinodb.

the class PhoenixMetadata method dropColumn.

@Override
public void dropColumn(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle column) {
    JdbcTableHandle handle = (JdbcTableHandle) tableHandle;
    JdbcColumnHandle columnHandle = (JdbcColumnHandle) column;
    phoenixClient.execute(session, format("ALTER TABLE %s DROP COLUMN %s", getEscapedTableName(handle.getSchemaName(), handle.getTableName()), columnHandle.getColumnName()));
}
Also used : JdbcColumnHandle(io.trino.plugin.jdbc.JdbcColumnHandle) JdbcTableHandle(io.trino.plugin.jdbc.JdbcTableHandle)

Example 4 with JdbcTableHandle

use of io.trino.plugin.jdbc.JdbcTableHandle in project trino by trinodb.

the class SqlServerClient method getTableDataCompressionWithRetries.

private static Optional<DataCompression> getTableDataCompressionWithRetries(Handle handle, JdbcTableHandle table) {
    // DDL operations can take out locks against system tables causing the `getTableDataCompression` query to deadlock
    final int maxAttemptCount = 3;
    RetryPolicy<Optional<DataCompression>> retryPolicy = new RetryPolicy<Optional<DataCompression>>().withMaxAttempts(maxAttemptCount).handleIf(throwable -> {
        final int deadlockErrorCode = 1205;
        Throwable rootCause = Throwables.getRootCause(throwable);
        return rootCause instanceof SQLServerException && ((SQLServerException) (rootCause)).getSQLServerError().getErrorNumber() == deadlockErrorCode;
    }).onFailedAttempt(event -> log.warn(event.getLastFailure(), "Attempt %d of %d: error when getting table compression info for '%s'", event.getAttemptCount(), maxAttemptCount, table));
    return Failsafe.with(retryPolicy).get(() -> getTableDataCompression(handle, table));
}
Also used : UNNECESSARY(java.math.RoundingMode.UNNECESSARY) AggregateFunction(io.trino.spi.connector.AggregateFunction) ZonedDateTime(java.time.ZonedDateTime) StandardColumnMappings.bigintWriteFunction(io.trino.plugin.jdbc.StandardColumnMappings.bigintWriteFunction) LongTimestampWithTimeZone(io.trino.spi.type.LongTimestampWithTimeZone) Slices.wrappedBuffer(io.airlift.slice.Slices.wrappedBuffer) NOT_SUPPORTED(io.trino.spi.StandardErrorCode.NOT_SUPPORTED) TimestampWithTimeZoneType(io.trino.spi.type.TimestampWithTimeZoneType) StandardColumnMappings.booleanColumnMapping(io.trino.plugin.jdbc.StandardColumnMappings.booleanColumnMapping) StandardColumnMappings.defaultVarcharColumnMapping(io.trino.plugin.jdbc.StandardColumnMappings.defaultVarcharColumnMapping) ResultSet(java.sql.ResultSet) Handle(org.jdbi.v3.core.Handle) Map(java.util.Map) StandardColumnMappings.doubleWriteFunction(io.trino.plugin.jdbc.StandardColumnMappings.doubleWriteFunction) SMALLINT(io.trino.spi.type.SmallintType.SMALLINT) TypeHandlingJdbcSessionProperties.getUnsupportedTypeHandling(io.trino.plugin.jdbc.TypeHandlingJdbcSessionProperties.getUnsupportedTypeHandling) ImplementAvgFloatingPoint(io.trino.plugin.jdbc.aggregation.ImplementAvgFloatingPoint) DateTimeEncoding.packDateTimeWithZone(io.trino.spi.type.DateTimeEncoding.packDateTimeWithZone) LongWriteFunction(io.trino.plugin.jdbc.LongWriteFunction) StandardColumnMappings.longTimestampWriteFunction(io.trino.plugin.jdbc.StandardColumnMappings.longTimestampWriteFunction) PreparedStatement(java.sql.PreparedStatement) TRANSACTION_SNAPSHOT(com.microsoft.sqlserver.jdbc.SQLServerConnection.TRANSACTION_SNAPSHOT) SchemaTableName(io.trino.spi.connector.SchemaTableName) ZoneId(java.time.ZoneId) Collectors.joining(java.util.stream.Collectors.joining) MoreExecutors.directExecutor(com.google.common.util.concurrent.MoreExecutors.directExecutor) StandardColumnMappings.fromTrinoTime(io.trino.plugin.jdbc.StandardColumnMappings.fromTrinoTime) LongReadFunction(io.trino.plugin.jdbc.LongReadFunction) Stream(java.util.stream.Stream) StandardColumnMappings.smallintWriteFunction(io.trino.plugin.jdbc.StandardColumnMappings.smallintWriteFunction) StandardColumnMappings.longDecimalWriteFunction(io.trino.plugin.jdbc.StandardColumnMappings.longDecimalWriteFunction) AggregateFunctionRewriter(io.trino.plugin.base.aggregation.AggregateFunctionRewriter) ConnectionFactory(io.trino.plugin.jdbc.ConnectionFactory) CONVERT_TO_VARCHAR(io.trino.plugin.jdbc.UnsupportedTypeHandling.CONVERT_TO_VARCHAR) JdbcConnectorExpressionRewriterBuilder(io.trino.plugin.jdbc.expression.JdbcConnectorExpressionRewriterBuilder) DateTimeEncoding.unpackMillisUtc(io.trino.spi.type.DateTimeEncoding.unpackMillisUtc) JdbcTableHandle(io.trino.plugin.jdbc.JdbcTableHandle) DATE(io.trino.spi.type.DateType.DATE) REAL(io.trino.spi.type.RealType.REAL) Joiner(com.google.common.base.Joiner) JoinCondition(io.trino.spi.connector.JoinCondition) StandardColumnMappings.doubleColumnMapping(io.trino.plugin.jdbc.StandardColumnMappings.doubleColumnMapping) Slice(io.airlift.slice.Slice) StandardColumnMappings.booleanWriteFunction(io.trino.plugin.jdbc.StandardColumnMappings.booleanWriteFunction) JdbcSplit(io.trino.plugin.jdbc.JdbcSplit) BOOLEAN(io.trino.spi.type.BooleanType.BOOLEAN) ConnectorTableMetadata(io.trino.spi.connector.ConnectorTableMetadata) StandardColumnMappings.bigintColumnMapping(io.trino.plugin.jdbc.StandardColumnMappings.bigintColumnMapping) TimestampType(io.trino.spi.type.TimestampType) StandardColumnMappings.defaultCharColumnMapping(io.trino.plugin.jdbc.StandardColumnMappings.defaultCharColumnMapping) Enums(com.google.common.base.Enums) SQLException(java.sql.SQLException) String.join(java.lang.String.join) TimeZoneKey(io.trino.spi.type.TimeZoneKey) StandardColumnMappings.charWriteFunction(io.trino.plugin.jdbc.StandardColumnMappings.charWriteFunction) StandardColumnMappings.decimalColumnMapping(io.trino.plugin.jdbc.StandardColumnMappings.decimalColumnMapping) Timestamps.round(io.trino.spi.type.Timestamps.round) ColumnHandle(io.trino.spi.connector.ColumnHandle) VARBINARY(io.trino.spi.type.VarbinaryType.VARBINARY) ConnectorExpressionRewriter(io.trino.plugin.base.expression.ConnectorExpressionRewriter) Math.floorDiv(java.lang.Math.floorDiv) AggregateFunctionRule(io.trino.plugin.base.aggregation.AggregateFunctionRule) Jdbi(org.jdbi.v3.core.Jdbi) StandardColumnMappings.realWriteFunction(io.trino.plugin.jdbc.StandardColumnMappings.realWriteFunction) DecimalType.createDecimalType(io.trino.spi.type.DecimalType.createDecimalType) QueryBuilder(io.trino.plugin.jdbc.QueryBuilder) StandardColumnMappings.smallintColumnMapping(io.trino.plugin.jdbc.StandardColumnMappings.smallintColumnMapping) Throwables(com.google.common.base.Throwables) ConnectorSession(io.trino.spi.connector.ConnectorSession) ImplementAvgDecimal(io.trino.plugin.jdbc.aggregation.ImplementAvgDecimal) Failsafe(net.jodah.failsafe.Failsafe) ExecutionException(java.util.concurrent.ExecutionException) DOUBLE(io.trino.spi.type.DoubleType.DOUBLE) TimeZoneKey.getTimeZoneKey(io.trino.spi.type.TimeZoneKey.getTimeZoneKey) IdentifierMapping(io.trino.plugin.jdbc.mapping.IdentifierMapping) VarbinaryType(io.trino.spi.type.VarbinaryType) CharType(io.trino.spi.type.CharType) Duration.ofMinutes(java.time.Duration.ofMinutes) StandardColumnMappings.timestampColumnMapping(io.trino.plugin.jdbc.StandardColumnMappings.timestampColumnMapping) TINYINT(io.trino.spi.type.TinyintType.TINYINT) StandardColumnMappings.shortDecimalWriteFunction(io.trino.plugin.jdbc.StandardColumnMappings.shortDecimalWriteFunction) VarcharType.createVarcharType(io.trino.spi.type.VarcharType.createVarcharType) JdbcExpression(io.trino.plugin.jdbc.JdbcExpression) WriteMapping(io.trino.plugin.jdbc.WriteMapping) JDBC_ERROR(io.trino.plugin.jdbc.JdbcErrorCode.JDBC_ERROR) BaseJdbcConfig(io.trino.plugin.jdbc.BaseJdbcConfig) Connection(java.sql.Connection) BiFunction(java.util.function.BiFunction) ImplementSum(io.trino.plugin.jdbc.aggregation.ImplementSum) ObjectWriteFunction(io.trino.plugin.jdbc.ObjectWriteFunction) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) DATA_COMPRESSION(io.trino.plugin.sqlserver.SqlServerTableProperties.DATA_COMPRESSION) DateTimeEncoding.unpackZoneKey(io.trino.spi.type.DateTimeEncoding.unpackZoneKey) TimestampType.createTimestampType(io.trino.spi.type.TimestampType.createTimestampType) ColumnMapping(io.trino.plugin.jdbc.ColumnMapping) LocalTime(java.time.LocalTime) INTEGER(io.trino.spi.type.IntegerType.INTEGER) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) TrinoException(io.trino.spi.TrinoException) RetryPolicy(net.jodah.failsafe.RetryPolicy) StandardColumnMappings.realColumnMapping(io.trino.plugin.jdbc.StandardColumnMappings.realColumnMapping) Math.min(java.lang.Math.min) JdbcOutputTableHandle(io.trino.plugin.jdbc.JdbcOutputTableHandle) Instant(java.time.Instant) String.format(java.lang.String.format) SafeCaches.buildNonEvictableCache(io.trino.collect.cache.SafeCaches.buildNonEvictableCache) JdbcSortItem(io.trino.plugin.jdbc.JdbcSortItem) List(java.util.List) JdbcTypeHandle(io.trino.plugin.jdbc.JdbcTypeHandle) OffsetDateTime(java.time.OffsetDateTime) SqlServerTableProperties.getDataCompression(io.trino.plugin.sqlserver.SqlServerTableProperties.getDataCompression) BIGINT(io.trino.spi.type.BigintType.BIGINT) LocalDate(java.time.LocalDate) Decimals(io.trino.spi.type.Decimals) Optional(java.util.Optional) Math.max(java.lang.Math.max) StandardColumnMappings.varcharReadFunction(io.trino.plugin.jdbc.StandardColumnMappings.varcharReadFunction) CacheBuilder(com.google.common.cache.CacheBuilder) SQLServerException(com.microsoft.sqlserver.jdbc.SQLServerException) DecimalType(io.trino.spi.type.DecimalType) StandardColumnMappings.integerColumnMapping(io.trino.plugin.jdbc.StandardColumnMappings.integerColumnMapping) Types(java.sql.Types) StandardColumnMappings.timestampWriteFunction(io.trino.plugin.jdbc.StandardColumnMappings.timestampWriteFunction) SliceWriteFunction(io.trino.plugin.jdbc.SliceWriteFunction) TimeType(io.trino.spi.type.TimeType) Logger(io.airlift.log.Logger) Math.floorMod(java.lang.Math.floorMod) StandardColumnMappings.varcharWriteFunction(io.trino.plugin.jdbc.StandardColumnMappings.varcharWriteFunction) StandardColumnMappings.tinyintWriteFunction(io.trino.plugin.jdbc.StandardColumnMappings.tinyintWriteFunction) PICOSECONDS_PER_NANOSECOND(io.trino.spi.type.Timestamps.PICOSECONDS_PER_NANOSECOND) Type(io.trino.spi.type.Type) VarcharType.createUnboundedVarcharType(io.trino.spi.type.VarcharType.createUnboundedVarcharType) TimeType.createTimeType(io.trino.spi.type.TimeType.createTimeType) Inject(javax.inject.Inject) VarcharType(io.trino.spi.type.VarcharType) MILLISECONDS_PER_SECOND(io.trino.spi.type.Timestamps.MILLISECONDS_PER_SECOND) Objects.requireNonNull(java.util.Objects.requireNonNull) BaseJdbcClient(io.trino.plugin.jdbc.BaseJdbcClient) RemoteTableName(io.trino.plugin.jdbc.RemoteTableName) NonEvictableCache(io.trino.collect.cache.NonEvictableCache) JdbcJoinCondition(io.trino.plugin.jdbc.JdbcJoinCondition) ImplementMinMax(io.trino.plugin.jdbc.aggregation.ImplementMinMax) JdbcColumnHandle(io.trino.plugin.jdbc.JdbcColumnHandle) PICOSECONDS_PER_DAY(io.trino.spi.type.Timestamps.PICOSECONDS_PER_DAY) StandardColumnMappings.integerWriteFunction(io.trino.plugin.jdbc.StandardColumnMappings.integerWriteFunction) NANOSECONDS_PER_MILLISECOND(io.trino.spi.type.Timestamps.NANOSECONDS_PER_MILLISECOND) GENERIC_INTERNAL_ERROR(io.trino.spi.StandardErrorCode.GENERIC_INTERNAL_ERROR) DISABLE_PUSHDOWN(io.trino.plugin.jdbc.PredicatePushdownController.DISABLE_PUSHDOWN) ObjectReadFunction(io.trino.plugin.jdbc.ObjectReadFunction) TimestampWithTimeZoneType.createTimestampWithTimeZoneType(io.trino.spi.type.TimestampWithTimeZoneType.createTimestampWithTimeZoneType) DateTimeFormatter(java.time.format.DateTimeFormatter) StandardColumnMappings.timeReadFunction(io.trino.plugin.jdbc.StandardColumnMappings.timeReadFunction) MAX_SHORT_PRECISION(io.trino.spi.type.TimestampType.MAX_SHORT_PRECISION) Optional(java.util.Optional) SQLServerException(com.microsoft.sqlserver.jdbc.SQLServerException) ImplementAvgFloatingPoint(io.trino.plugin.jdbc.aggregation.ImplementAvgFloatingPoint)

Example 5 with JdbcTableHandle

use of io.trino.plugin.jdbc.JdbcTableHandle in project trino by trinodb.

the class BaseSqlServerConnectorTest method testPredicatePushdown.

@Test
public void testPredicatePushdown() {
    // varchar equality
    assertThat(query("SELECT regionkey, nationkey, name FROM nation WHERE name = 'ROMANIA'")).matches("VALUES (BIGINT '3', BIGINT '19', CAST('ROMANIA' AS varchar(25)))").isNotFullyPushedDown(FilterNode.class);
    // varchar range
    assertThat(query("SELECT regionkey, nationkey, name FROM nation WHERE name BETWEEN 'POLAND' AND 'RPA'")).matches("VALUES (BIGINT '3', BIGINT '19', CAST('ROMANIA' AS varchar(25)))").isNotFullyPushedDown(FilterNode.class);
    // varchar IN without domain compaction
    assertThat(query("SELECT regionkey, nationkey, name FROM nation WHERE name IN ('POLAND', 'ROMANIA', 'VIETNAM')")).matches("VALUES " + "(BIGINT '3', BIGINT '19', CAST('ROMANIA' AS varchar(25))), " + "(BIGINT '2', BIGINT '21', CAST('VIETNAM' AS varchar(25)))").isNotFullyPushedDown(node(FilterNode.class, // verify that pushed down constraint is applied by the connector
    tableScan(tableHandle -> {
        TupleDomain<ColumnHandle> constraint = ((JdbcTableHandle) tableHandle).getConstraint();
        ColumnHandle nameColumn = constraint.getDomains().orElseThrow().keySet().stream().map(JdbcColumnHandle.class::cast).filter(column -> column.getColumnName().equals("name")).collect(onlyElement());
        return constraint.getDomains().get().get(nameColumn).equals(Domain.multipleValues(createVarcharType(25), ImmutableList.of(utf8Slice("POLAND"), utf8Slice("ROMANIA"), utf8Slice("VIETNAM"))));
    }, TupleDomain.all(), ImmutableMap.of())));
    // varchar IN with small compaction threshold
    assertThat(query(Session.builder(getSession()).setCatalogSessionProperty("sqlserver", "domain_compaction_threshold", "1").build(), "SELECT regionkey, nationkey, name FROM nation WHERE name IN ('POLAND', 'ROMANIA', 'VIETNAM')")).matches("VALUES " + "(BIGINT '3', BIGINT '19', CAST('ROMANIA' AS varchar(25))), " + "(BIGINT '2', BIGINT '21', CAST('VIETNAM' AS varchar(25)))").isNotFullyPushedDown(node(FilterNode.class, // verify that no constraint is applied by the connector
    tableScan(tableHandle -> ((JdbcTableHandle) tableHandle).getConstraint().isAll(), TupleDomain.all(), ImmutableMap.of())));
    // varchar different case
    assertThat(query("SELECT regionkey, nationkey, name FROM nation WHERE name = 'romania'")).returnsEmptyResult().isNotFullyPushedDown(FilterNode.class);
    // bigint equality
    assertThat(query("SELECT regionkey, nationkey, name FROM nation WHERE nationkey = 19")).matches("VALUES (BIGINT '3', BIGINT '19', CAST('ROMANIA' AS varchar(25)))").isFullyPushedDown();
    // bigint equality with small compaction threshold
    assertThat(query(Session.builder(getSession()).setCatalogSessionProperty("sqlserver", "domain_compaction_threshold", "1").build(), "SELECT regionkey, nationkey, name FROM nation WHERE nationkey IN (19, 21)")).matches("VALUES " + "(BIGINT '3', BIGINT '19', CAST('ROMANIA' AS varchar(25))), " + "(BIGINT '2', BIGINT '21', CAST('VIETNAM' AS varchar(25)))").isNotFullyPushedDown(FilterNode.class);
    // bigint range, with decimal to bigint simplification
    assertThat(query("SELECT regionkey, nationkey, name FROM nation WHERE nationkey BETWEEN 18.5 AND 19.5")).matches("VALUES (BIGINT '3', BIGINT '19', CAST('ROMANIA' AS varchar(25)))").isFullyPushedDown();
    // date equality
    assertThat(query("SELECT orderkey FROM orders WHERE orderdate = DATE '1992-09-29'")).matches("VALUES BIGINT '1250', 34406, 38436, 57570").isFullyPushedDown();
    // predicate over aggregation key (likely to be optimized before being pushed down into the connector)
    assertThat(query("SELECT * FROM (SELECT regionkey, sum(nationkey) FROM nation GROUP BY regionkey) WHERE regionkey = 3")).matches("VALUES (BIGINT '3', BIGINT '77')").isFullyPushedDown();
    // predicate over aggregation result
    assertThat(query("SELECT regionkey, sum(nationkey) FROM nation GROUP BY regionkey HAVING sum(nationkey) = 77")).matches("VALUES (BIGINT '3', BIGINT '77')").isFullyPushedDown();
    // decimals
    try (TestTable testTable = new TestTable(onRemoteDatabase(), "test_decimal_pushdown", "(short_decimal decimal(9, 3), long_decimal decimal(30, 10))", List.of("123.321, 123456789.987654321"))) {
        assertThat(query("SELECT * FROM " + testTable.getName() + " WHERE short_decimal <= 124")).matches("VALUES (CAST(123.321 AS decimal(9,3)), CAST(123456789.987654321 AS decimal(30, 10)))").isFullyPushedDown();
        assertThat(query("SELECT * FROM " + testTable.getName() + " WHERE short_decimal <= 124")).matches("VALUES (CAST(123.321 AS decimal(9,3)), CAST(123456789.987654321 AS decimal(30, 10)))").isFullyPushedDown();
        assertThat(query("SELECT * FROM " + testTable.getName() + " WHERE long_decimal <= 123456790")).matches("VALUES (CAST(123.321 AS decimal(9,3)), CAST(123456789.987654321 AS decimal(30, 10)))").isFullyPushedDown();
        assertThat(query("SELECT * FROM " + testTable.getName() + " WHERE short_decimal <= 123.321")).matches("VALUES (CAST(123.321 AS decimal(9,3)), CAST(123456789.987654321 AS decimal(30, 10)))").isFullyPushedDown();
        assertThat(query("SELECT * FROM " + testTable.getName() + " WHERE long_decimal <= 123456789.987654321")).matches("VALUES (CAST(123.321 AS decimal(9,3)), CAST(123456789.987654321 AS decimal(30, 10)))").isFullyPushedDown();
        assertThat(query("SELECT * FROM " + testTable.getName() + " WHERE short_decimal = 123.321")).matches("VALUES (CAST(123.321 AS decimal(9,3)), CAST(123456789.987654321 AS decimal(30, 10)))").isFullyPushedDown();
        assertThat(query("SELECT * FROM " + testTable.getName() + " WHERE long_decimal = 123456789.987654321")).matches("VALUES (CAST(123.321 AS decimal(9,3)), CAST(123456789.987654321 AS decimal(30, 10)))").isFullyPushedDown();
    }
}
Also used : SkipException(org.testng.SkipException) DataProvider(org.testng.annotations.DataProvider) IntStream.range(java.util.stream.IntStream.range) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Assert.assertEquals(org.testng.Assert.assertEquals) Test(org.testng.annotations.Test) TestTable(io.trino.testing.sql.TestTable) MoreCollectors.onlyElement(com.google.common.collect.MoreCollectors.onlyElement) FilterNode(io.trino.sql.planner.plan.FilterNode) NONE(io.trino.plugin.sqlserver.DataCompression.NONE) ImmutableList(com.google.common.collect.ImmutableList) ROW(io.trino.plugin.sqlserver.DataCompression.ROW) TestingConnectorBehavior(io.trino.testing.TestingConnectorBehavior) ColumnHandle(io.trino.spi.connector.ColumnHandle) Slices.utf8Slice(io.airlift.slice.Slices.utf8Slice) TestTable.randomTableSuffix(io.trino.testing.sql.TestTable.randomTableSuffix) Flaky(io.trino.testng.services.Flaky) ImmutableMap(com.google.common.collect.ImmutableMap) JdbcColumnHandle(io.trino.plugin.jdbc.JdbcColumnHandle) Domain(io.trino.spi.predicate.Domain) TupleDomain(io.trino.spi.predicate.TupleDomain) String.format(java.lang.String.format) Collectors.joining(java.util.stream.Collectors.joining) BaseJdbcConnectorTest(io.trino.plugin.jdbc.BaseJdbcConnectorTest) PlanMatchPattern.node(io.trino.sql.planner.assertions.PlanMatchPattern.node) List(java.util.List) PAGE(io.trino.plugin.sqlserver.DataCompression.PAGE) Optional(java.util.Optional) Assert.assertTrue(org.testng.Assert.assertTrue) VarcharType.createVarcharType(io.trino.spi.type.VarcharType.createVarcharType) JdbcTableHandle(io.trino.plugin.jdbc.JdbcTableHandle) PlanMatchPattern.tableScan(io.trino.sql.planner.assertions.PlanMatchPattern.tableScan) Session(io.trino.Session) ColumnHandle(io.trino.spi.connector.ColumnHandle) JdbcColumnHandle(io.trino.plugin.jdbc.JdbcColumnHandle) FilterNode(io.trino.sql.planner.plan.FilterNode) JdbcColumnHandle(io.trino.plugin.jdbc.JdbcColumnHandle) TestTable(io.trino.testing.sql.TestTable) JdbcTableHandle(io.trino.plugin.jdbc.JdbcTableHandle) Test(org.testng.annotations.Test) BaseJdbcConnectorTest(io.trino.plugin.jdbc.BaseJdbcConnectorTest)

Aggregations

JdbcTableHandle (io.trino.plugin.jdbc.JdbcTableHandle)18 JdbcColumnHandle (io.trino.plugin.jdbc.JdbcColumnHandle)13 Connection (java.sql.Connection)7 SQLException (java.sql.SQLException)7 List (java.util.List)7 ImmutableList (com.google.common.collect.ImmutableList)6 TrinoException (io.trino.spi.TrinoException)6 Optional (java.util.Optional)6 ColumnHandle (io.trino.spi.connector.ColumnHandle)5 ConnectorSession (io.trino.spi.connector.ConnectorSession)5 String.format (java.lang.String.format)5 Inject (javax.inject.Inject)5 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)4 ImmutableMap (com.google.common.collect.ImmutableMap)4 Objects.requireNonNull (java.util.Objects.requireNonNull)4 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)3 Slice (io.airlift.slice.Slice)3 Map (java.util.Map)3 Enums (com.google.common.base.Enums)2 Verify.verify (com.google.common.base.Verify.verify)2