Search in sources :

Example 1 with BlockWriteFunction

use of io.prestosql.plugin.jdbc.BlockWriteFunction in project hetu-core by openlookeng.

the class ClickHouseQueryBuilder method buildSql.

@Override
public PreparedStatement buildSql(JdbcClient client, ConnectorSession session, Connection connection, String catalog, String schema, String table, List<JdbcColumnHandle> columns, TupleDomain<ColumnHandle> tupleDomain, Optional<String> additionalPredicate, Function<String, String> sqlFunction) throws SQLException {
    StringBuilder sql = new StringBuilder();
    String columnNames = columns.stream().map(JdbcColumnHandle::getColumnName).map(this::quote).collect(joining(", "));
    sql.append("SELECT ");
    sql.append(columnNames);
    if (columns.isEmpty()) {
        sql.append("null");
    }
    sql.append(" FROM ");
    if (!isNullOrEmpty(schema)) {
        sql.append(quote(schema)).append('.');
    }
    if (isPushSubQueryDown) {
        sql.append("(").append(table).append(") pushdown");
    } else {
        sql.append(quote(table));
    }
    List<TypeAndValue> accumulator = new ArrayList<>();
    List<String> clauses = toConjuncts(client, session, connection, columns, tupleDomain, accumulator);
    if (additionalPredicate.isPresent()) {
        clauses = ImmutableList.<String>builder().addAll(clauses).add(additionalPredicate.get()).build();
    }
    if (!clauses.isEmpty()) {
        sql.append(" WHERE ").append(Joiner.on(" AND ").join(clauses));
    }
    String query = sqlFunction.apply(sql.toString());
    PreparedStatement statement = client.getPreparedStatement(connection, query);
    for (int i = 0; i < accumulator.size(); i++) {
        TypeAndValue typeAndValue = accumulator.get(i);
        int parameterIndex = i + 1;
        Type type = typeAndValue.getType();
        WriteFunction writeFunction = client.toPrestoType(session, connection, typeAndValue.getTypeHandle()).orElseThrow(() -> new VerifyException(format("Unsupported type %s with handle %s", type, typeAndValue.getTypeHandle()))).getWriteFunction();
        Class<?> javaType = type.getJavaType();
        Object value = typeAndValue.getValue();
        if (javaType == boolean.class) {
            ((BooleanWriteFunction) writeFunction).set(statement, parameterIndex, (boolean) value);
        } else if (javaType == long.class) {
            ((LongWriteFunction) writeFunction).set(statement, parameterIndex, (long) value);
        } else if (javaType == double.class) {
            ((DoubleWriteFunction) writeFunction).set(statement, parameterIndex, (double) value);
        } else if (javaType == Slice.class) {
            ((SliceWriteFunction) writeFunction).set(statement, parameterIndex, (Slice) value);
        } else if (javaType == Block.class) {
            ((BlockWriteFunction) writeFunction).set(statement, parameterIndex, (Block) value);
        } else {
            throw new VerifyException(format("Unexpected type %s with java type %s", type, javaType.getName()));
        }
    }
    return statement;
}
Also used : JdbcColumnHandle(io.prestosql.plugin.jdbc.JdbcColumnHandle) ArrayList(java.util.ArrayList) DoubleWriteFunction(io.prestosql.plugin.jdbc.DoubleWriteFunction) PreparedStatement(java.sql.PreparedStatement) BooleanWriteFunction(io.prestosql.plugin.jdbc.BooleanWriteFunction) Type(io.prestosql.spi.type.Type) RealType(io.prestosql.spi.type.RealType) ArrayType(io.prestosql.spi.type.ArrayType) TimestampType(io.prestosql.spi.type.TimestampType) BigintType(io.prestosql.spi.type.BigintType) CharType(io.prestosql.spi.type.CharType) DoubleType(io.prestosql.spi.type.DoubleType) TimestampWithTimeZoneType(io.prestosql.spi.type.TimestampWithTimeZoneType) SmallintType(io.prestosql.spi.type.SmallintType) TimeWithTimeZoneType(io.prestosql.spi.type.TimeWithTimeZoneType) IntegerType(io.prestosql.spi.type.IntegerType) TimeType(io.prestosql.spi.type.TimeType) TinyintType(io.prestosql.spi.type.TinyintType) DateType(io.prestosql.spi.type.DateType) BooleanType(io.prestosql.spi.type.BooleanType) VarcharType(io.prestosql.spi.type.VarcharType) VerifyException(com.google.common.base.VerifyException) SliceWriteFunction(io.prestosql.plugin.jdbc.SliceWriteFunction) BlockWriteFunction(io.prestosql.plugin.jdbc.BlockWriteFunction) LongWriteFunction(io.prestosql.plugin.jdbc.LongWriteFunction) DoubleWriteFunction(io.prestosql.plugin.jdbc.DoubleWriteFunction) WriteFunction(io.prestosql.plugin.jdbc.WriteFunction) BooleanWriteFunction(io.prestosql.plugin.jdbc.BooleanWriteFunction) Slice(io.airlift.slice.Slice) BlockWriteFunction(io.prestosql.plugin.jdbc.BlockWriteFunction)

Example 2 with BlockWriteFunction

use of io.prestosql.plugin.jdbc.BlockWriteFunction in project hetu-core by openlookeng.

the class OracleClient method setStatement.

private void setStatement(ConnectorSession session, ConnectorTableHandle tableHandle, PreparedStatement statement, Block block, int position, int channel) throws SQLException {
    JdbcTableHandle jdbcTableHandle = (JdbcTableHandle) tableHandle;
    List<Type> updatedColumnTypes = jdbcTableHandle.getUpdatedColumnTypes();
    List<WriteMapping> writeMappings = updatedColumnTypes.stream().map(type -> {
        WriteMapping writeMapping = toWriteMapping(session, type);
        WriteFunction writeFunction = writeMapping.getWriteFunction();
        verify(type.getJavaType() == writeFunction.getJavaType(), "openLooKeng type %s is not compatible with write function %s accepting %s", type, writeFunction, writeFunction.getJavaType());
        return writeMapping;
    }).collect(toImmutableList());
    List<WriteFunction> columnWriters = writeMappings.stream().map(WriteMapping::getWriteFunction).collect(toImmutableList());
    List<WriteNullFunction> nullWriters = writeMappings.stream().map(WriteMapping::getWriteNullFunction).collect(toImmutableList());
    int parameterIndex = channel + 1;
    if (block.isNull(position)) {
        nullWriters.get(channel).setNull(statement, parameterIndex);
        return;
    }
    Type type = jdbcTableHandle.getUpdatedColumnTypes().get(channel);
    Class<?> javaType = type.getJavaType();
    WriteFunction writeFunction = columnWriters.get(channel);
    if (javaType == boolean.class) {
        ((BooleanWriteFunction) writeFunction).set(statement, parameterIndex, type.getBoolean(block, position));
    } else if (javaType == long.class) {
        ((LongWriteFunction) writeFunction).set(statement, parameterIndex, type.getLong(block, position));
    } else if (javaType == double.class) {
        ((DoubleWriteFunction) writeFunction).set(statement, parameterIndex, type.getDouble(block, position));
    } else if (javaType == Slice.class) {
        ((SliceWriteFunction) writeFunction).set(statement, parameterIndex, type.getSlice(block, position));
    } else if (javaType == Block.class) {
        ((BlockWriteFunction) writeFunction).set(statement, parameterIndex, (Block) type.getObject(block, position));
    } else {
        throw new VerifyException(format("Unexpected type %s with java type %s", type, javaType.getName()));
    }
}
Also used : SliceWriteFunction(io.prestosql.plugin.jdbc.SliceWriteFunction) StandardColumnMappings.smallintWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.smallintWriteFunction) BlockWriteFunction(io.prestosql.plugin.jdbc.BlockWriteFunction) DeterminismEvaluator(io.prestosql.spi.relation.DeterminismEvaluator) DateTimeEncoding(io.prestosql.spi.type.DateTimeEncoding) BigDecimal(java.math.BigDecimal) StandardColumnMappings.integerWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.integerWriteFunction) ResultSet(java.sql.ResultSet) JdbcPushDownParameter(io.prestosql.plugin.jdbc.optimization.JdbcPushDownParameter) Map(java.util.Map) FunctionMetadataManager(io.prestosql.spi.function.FunctionMetadataManager) StandardColumnMappings.tinyintColumnMapping(io.prestosql.plugin.jdbc.StandardColumnMappings.tinyintColumnMapping) Slices.utf8Slice(io.airlift.slice.Slices.utf8Slice) ENGLISH(java.util.Locale.ENGLISH) StandardColumnMappings.shortDecimalWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.shortDecimalWriteFunction) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) ConnectionFactory(io.prestosql.plugin.jdbc.ConnectionFactory) DoubleWriteFunction(io.prestosql.plugin.jdbc.DoubleWriteFunction) TIMESTAMP(io.prestosql.spi.type.TimestampType.TIMESTAMP) PreparedStatement(java.sql.PreparedStatement) VarcharType.createVarcharType(io.prestosql.spi.type.VarcharType.createVarcharType) JdbcQueryGeneratorResult(io.prestosql.plugin.jdbc.optimization.JdbcQueryGeneratorResult) WriteFunction(io.prestosql.plugin.jdbc.WriteFunction) StandardColumnMappings.varbinaryWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.varbinaryWriteFunction) AbstractType(io.prestosql.spi.type.AbstractType) StandardColumnMappings.bigintWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.bigintWriteFunction) JDBC_ERROR(io.prestosql.plugin.jdbc.JdbcErrorCode.JDBC_ERROR) TIMESTAMP_WITH_TIME_ZONE(io.prestosql.spi.type.TimestampWithTimeZoneType.TIMESTAMP_WITH_TIME_ZONE) JdbcTableHandle(io.prestosql.plugin.jdbc.JdbcTableHandle) StandardColumnMappings.smallintColumnMapping(io.prestosql.plugin.jdbc.StandardColumnMappings.smallintColumnMapping) Slice(io.airlift.slice.Slice) JdbcConverterContext(io.prestosql.plugin.jdbc.optimization.JdbcConverterContext) LocalDateTime(java.time.LocalDateTime) StandardColumnMappings.timestampColumnMappingUsingSqlTimestamp(io.prestosql.plugin.jdbc.StandardColumnMappings.timestampColumnMappingUsingSqlTimestamp) CharType(io.prestosql.spi.type.CharType) Strings.isNullOrEmpty(com.google.common.base.Strings.isNullOrEmpty) DatabaseMetaData(java.sql.DatabaseMetaData) StandardFunctionResolution(io.prestosql.spi.function.StandardFunctionResolution) JdbcIdentity(io.prestosql.plugin.jdbc.JdbcIdentity) ArrayList(java.util.ArrayList) JDBCType(java.sql.JDBCType) OptionalLong(java.util.OptionalLong) SQLException(java.sql.SQLException) VARCHAR(io.prestosql.spi.type.VarcharType.VARCHAR) StandardColumnMappings.tinyintWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.tinyintWriteFunction) DOUBLE(io.prestosql.spi.type.DoubleType.DOUBLE) BaseJdbcConfig(io.prestosql.plugin.jdbc.BaseJdbcConfig) CharMatcher(com.google.common.base.CharMatcher) StandardColumnMappings.bigintColumnMapping(io.prestosql.plugin.jdbc.StandardColumnMappings.bigintColumnMapping) StandardColumnMappings.varbinaryColumnMapping(io.prestosql.plugin.jdbc.StandardColumnMappings.varbinaryColumnMapping) StandardColumnMappings.timestampWriteFunctionUsingSqlTimestamp(io.prestosql.plugin.jdbc.StandardColumnMappings.timestampWriteFunctionUsingSqlTimestamp) StandardColumnMappings.varcharWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.varcharWriteFunction) VARBINARY(io.prestosql.spi.type.VarbinaryType.VARBINARY) RoundingMode(io.hetu.core.plugin.oracle.config.RoundingMode) BooleanWriteFunction(io.prestosql.plugin.jdbc.BooleanWriteFunction) ColumnHandle(io.prestosql.spi.connector.ColumnHandle) VarcharType(io.prestosql.spi.type.VarcharType) Connection(java.sql.Connection) SuppressFBWarnings(io.prestosql.spi.SuppressFBWarnings) StandardColumnMappings.longDecimalWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.longDecimalWriteFunction) DecimalType(io.prestosql.spi.type.DecimalType) LongWriteFunction(io.prestosql.plugin.jdbc.LongWriteFunction) WriteMapping(io.prestosql.plugin.jdbc.WriteMapping) JdbcPushDownModule(io.prestosql.plugin.jdbc.optimization.JdbcPushDownModule) JdbcTypeHandle(io.prestosql.plugin.jdbc.JdbcTypeHandle) ConnectorSession(io.prestosql.spi.connector.ConnectorSession) Locale(java.util.Locale) OracleQueryGenerator(io.hetu.core.plugin.oracle.optimization.OracleQueryGenerator) BOOLEAN(io.prestosql.spi.type.BooleanType.BOOLEAN) Type(io.prestosql.spi.type.Type) BIGINT(io.prestosql.spi.type.BigintType.BIGINT) DecimalType.createDecimalType(io.prestosql.spi.type.DecimalType.createDecimalType) Decimals.encodeShortScaledValue(io.prestosql.spi.type.Decimals.encodeShortScaledValue) Byte.toUnsignedInt(java.lang.Byte.toUnsignedInt) PrestoException(io.prestosql.spi.PrestoException) ImmutableMap(com.google.common.collect.ImmutableMap) StandardColumnMappings.realColumnMapping(io.prestosql.plugin.jdbc.StandardColumnMappings.realColumnMapping) Timestamp(java.sql.Timestamp) Collection(java.util.Collection) CharType.createCharType(io.prestosql.spi.type.CharType.createCharType) TINYINT(io.prestosql.spi.type.TinyintType.TINYINT) Math.min(java.lang.Math.min) Instant(java.time.Instant) String.format(java.lang.String.format) RowExpressionService(io.prestosql.spi.relation.RowExpressionService) List(java.util.List) VarcharType.createUnboundedVarcharType(io.prestosql.spi.type.VarcharType.createUnboundedVarcharType) StandardColumnMappings.doubleColumnMapping(io.prestosql.plugin.jdbc.StandardColumnMappings.doubleColumnMapping) UTC(java.time.ZoneOffset.UTC) Optional(java.util.Optional) Math.max(java.lang.Math.max) NOT_SUPPORTED(io.prestosql.spi.StandardErrorCode.NOT_SUPPORTED) TypeSignature(io.prestosql.spi.type.TypeSignature) StandardColumnMappings.varcharColumnMapping(io.prestosql.plugin.jdbc.StandardColumnMappings.varcharColumnMapping) ResultSetMetaData(java.sql.ResultSetMetaData) Types(java.sql.Types) JdbcColumnHandle(io.prestosql.plugin.jdbc.JdbcColumnHandle) WriteNullFunction(io.prestosql.plugin.jdbc.WriteNullFunction) Logger(io.airlift.log.Logger) Decimals(io.prestosql.spi.type.Decimals) HashMap(java.util.HashMap) INTEGER(io.prestosql.spi.type.IntegerType.INTEGER) UnsupportedTypeHandling(io.hetu.core.plugin.oracle.config.UnsupportedTypeHandling) StandardColumnMappings.booleanWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.booleanWriteFunction) ColumnMapping(io.prestosql.plugin.jdbc.ColumnMapping) Inject(javax.inject.Inject) QueryGenerator(io.prestosql.spi.sql.QueryGenerator) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) ImmutableList(com.google.common.collect.ImmutableList) Verify.verify(com.google.common.base.Verify.verify) Objects.requireNonNull(java.util.Objects.requireNonNull) StandardColumnMappings.integerColumnMapping(io.prestosql.plugin.jdbc.StandardColumnMappings.integerColumnMapping) DATE(io.prestosql.spi.type.DateType.DATE) REAL(io.prestosql.spi.type.RealType.REAL) Block(io.prestosql.spi.block.Block) VerifyException(com.google.common.base.VerifyException) ConnectorTableHandle(io.prestosql.spi.connector.ConnectorTableHandle) StandardColumnMappings.realWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.realWriteFunction) StatsCollecting(io.prestosql.plugin.jdbc.StatsCollecting) BaseJdbcClient(io.prestosql.plugin.jdbc.BaseJdbcClient) SMALLINT(io.prestosql.spi.type.SmallintType.SMALLINT) Collections(java.util.Collections) StandardColumnMappings.doubleWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.doubleWriteFunction) DoubleWriteFunction(io.prestosql.plugin.jdbc.DoubleWriteFunction) JdbcTableHandle(io.prestosql.plugin.jdbc.JdbcTableHandle) BooleanWriteFunction(io.prestosql.plugin.jdbc.BooleanWriteFunction) VarcharType.createVarcharType(io.prestosql.spi.type.VarcharType.createVarcharType) AbstractType(io.prestosql.spi.type.AbstractType) CharType(io.prestosql.spi.type.CharType) JDBCType(java.sql.JDBCType) VarcharType(io.prestosql.spi.type.VarcharType) DecimalType(io.prestosql.spi.type.DecimalType) Type(io.prestosql.spi.type.Type) DecimalType.createDecimalType(io.prestosql.spi.type.DecimalType.createDecimalType) CharType.createCharType(io.prestosql.spi.type.CharType.createCharType) VarcharType.createUnboundedVarcharType(io.prestosql.spi.type.VarcharType.createUnboundedVarcharType) VerifyException(com.google.common.base.VerifyException) SliceWriteFunction(io.prestosql.plugin.jdbc.SliceWriteFunction) StandardColumnMappings.smallintWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.smallintWriteFunction) BlockWriteFunction(io.prestosql.plugin.jdbc.BlockWriteFunction) StandardColumnMappings.integerWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.integerWriteFunction) StandardColumnMappings.shortDecimalWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.shortDecimalWriteFunction) DoubleWriteFunction(io.prestosql.plugin.jdbc.DoubleWriteFunction) WriteFunction(io.prestosql.plugin.jdbc.WriteFunction) StandardColumnMappings.varbinaryWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.varbinaryWriteFunction) StandardColumnMappings.bigintWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.bigintWriteFunction) StandardColumnMappings.tinyintWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.tinyintWriteFunction) StandardColumnMappings.varcharWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.varcharWriteFunction) BooleanWriteFunction(io.prestosql.plugin.jdbc.BooleanWriteFunction) StandardColumnMappings.longDecimalWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.longDecimalWriteFunction) LongWriteFunction(io.prestosql.plugin.jdbc.LongWriteFunction) StandardColumnMappings.booleanWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.booleanWriteFunction) StandardColumnMappings.realWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.realWriteFunction) StandardColumnMappings.doubleWriteFunction(io.prestosql.plugin.jdbc.StandardColumnMappings.doubleWriteFunction) Slices.utf8Slice(io.airlift.slice.Slices.utf8Slice) Slice(io.airlift.slice.Slice) WriteNullFunction(io.prestosql.plugin.jdbc.WriteNullFunction) BlockWriteFunction(io.prestosql.plugin.jdbc.BlockWriteFunction) WriteMapping(io.prestosql.plugin.jdbc.WriteMapping)

Example 3 with BlockWriteFunction

use of io.prestosql.plugin.jdbc.BlockWriteFunction in project hetu-core by openlookeng.

the class BasePostgreSqlClient method setStatement.

private void setStatement(ConnectorSession session, ConnectorTableHandle tableHandle, PreparedStatement statement, Block block, int position, int channel) throws SQLException {
    JdbcTableHandle jdbcTableHandle = (JdbcTableHandle) tableHandle;
    List<Type> updatedColumnTypes = jdbcTableHandle.getUpdatedColumnTypes();
    List<WriteMapping> writeMappings = updatedColumnTypes.stream().map(type -> {
        WriteMapping writeMapping = toWriteMapping(session, type);
        WriteFunction writeFunction = writeMapping.getWriteFunction();
        verify(type.getJavaType() == writeFunction.getJavaType(), "openLooKeng type %s is not compatible with write function %s accepting %s", type, writeFunction, writeFunction.getJavaType());
        return writeMapping;
    }).collect(toImmutableList());
    List<WriteFunction> columnWriters = writeMappings.stream().map(WriteMapping::getWriteFunction).collect(toImmutableList());
    List<WriteNullFunction> nullWriters = writeMappings.stream().map(WriteMapping::getWriteNullFunction).collect(toImmutableList());
    int parameterIndex = channel + 1;
    if (block.isNull(position)) {
        nullWriters.get(channel).setNull(statement, parameterIndex);
        return;
    }
    Type type = jdbcTableHandle.getUpdatedColumnTypes().get(channel);
    Class<?> javaType = type.getJavaType();
    WriteFunction writeFunction = columnWriters.get(channel);
    if (javaType == boolean.class) {
        ((BooleanWriteFunction) writeFunction).set(statement, parameterIndex, type.getBoolean(block, position));
    } else if (javaType == long.class) {
        ((LongWriteFunction) writeFunction).set(statement, parameterIndex, type.getLong(block, position));
    } else if (javaType == double.class) {
        ((DoubleWriteFunction) writeFunction).set(statement, parameterIndex, type.getDouble(block, position));
    } else if (javaType == Slice.class) {
        ((SliceWriteFunction) writeFunction).set(statement, parameterIndex, type.getSlice(block, position));
    } else if (javaType == Block.class) {
        ((BlockWriteFunction) writeFunction).set(statement, parameterIndex, (Block) type.getObject(block, position));
    } else {
        throw new VerifyException(format("Unexpected type %s with java type %s", type, javaType.getName()));
    }
}
Also used : SliceWriteFunction(io.prestosql.plugin.jdbc.SliceWriteFunction) Connection(java.sql.Connection) ORDER_MAP_ENTRIES_BY_KEYS(com.fasterxml.jackson.databind.SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS) BiFunction(java.util.function.BiFunction) INVALID_FUNCTION_ARGUMENT(io.prestosql.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT) BlockWriteFunction(io.prestosql.plugin.jdbc.BlockWriteFunction) DatabaseMetaData.columnNoNulls(java.sql.DatabaseMetaData.columnNoNulls) LongWriteFunction(io.prestosql.plugin.jdbc.LongWriteFunction) WriteMapping(io.prestosql.plugin.jdbc.WriteMapping) JdbcPushDownModule(io.prestosql.plugin.jdbc.optimization.JdbcPushDownModule) Array(java.sql.Array) CANONICALIZE_FIELD_NAMES(com.fasterxml.jackson.core.JsonFactory.Feature.CANONICALIZE_FIELD_NAMES) ObjectMapperProvider(io.airlift.json.ObjectMapperProvider) JdbcTypeHandle(io.prestosql.plugin.jdbc.JdbcTypeHandle) ConnectorSession(io.prestosql.spi.connector.ConnectorSession) TableNotFoundException(io.prestosql.spi.connector.TableNotFoundException) ResultSet(java.sql.ResultSet) Map(java.util.Map) Type(io.prestosql.spi.type.Type) ENGLISH(java.util.Locale.ENGLISH) PrestoException(io.prestosql.spi.PrestoException) DateTimeEncoding.unpackMillisUtc(io.prestosql.spi.type.DateTimeEncoding.unpackMillisUtc) ImmutableMap(com.google.common.collect.ImmutableMap) ArrayType(io.prestosql.spi.type.ArrayType) Collection(java.util.Collection) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) ConnectionFactory(io.prestosql.plugin.jdbc.ConnectionFactory) DoubleWriteFunction(io.prestosql.plugin.jdbc.DoubleWriteFunction) UUID(java.util.UUID) PreparedStatement(java.sql.PreparedStatement) String.format(java.lang.String.format) TypeInfo(org.postgresql.core.TypeInfo) WriteFunction(io.prestosql.plugin.jdbc.WriteFunction) List(java.util.List) JDBC_ERROR(io.prestosql.plugin.jdbc.JdbcErrorCode.JDBC_ERROR) Slices.wrappedLongArray(io.airlift.slice.Slices.wrappedLongArray) Optional(java.util.Optional) NOT_SUPPORTED(io.prestosql.spi.StandardErrorCode.NOT_SUPPORTED) TIMESTAMP_WITH_TIME_ZONE(io.prestosql.spi.type.TimestampWithTimeZoneType.TIMESTAMP_WITH_TIME_ZONE) TypeSignature(io.prestosql.spi.type.TypeSignature) JdbcTableHandle(io.prestosql.plugin.jdbc.JdbcTableHandle) Types(java.sql.Types) ALREADY_EXISTS(io.prestosql.spi.StandardErrorCode.ALREADY_EXISTS) JdbcColumnHandle(io.prestosql.plugin.jdbc.JdbcColumnHandle) WriteNullFunction(io.prestosql.plugin.jdbc.WriteNullFunction) DateTimeEncoding.packDateTimeWithZone(io.prestosql.spi.type.DateTimeEncoding.packDateTimeWithZone) Slice(io.airlift.slice.Slice) StandardTypes(io.prestosql.spi.type.StandardTypes) UTC_KEY(io.prestosql.spi.type.TimeZoneKey.UTC_KEY) Logger(io.airlift.log.Logger) SliceOutput(io.airlift.slice.SliceOutput) Strings.isNullOrEmpty(com.google.common.base.Strings.isNullOrEmpty) DatabaseMetaData(java.sql.DatabaseMetaData) HashMap(java.util.HashMap) JdbcIdentity(io.prestosql.plugin.jdbc.JdbcIdentity) ColumnMapping(io.prestosql.plugin.jdbc.ColumnMapping) ArrayList(java.util.ArrayList) TypeUtils.jdbcObjectArrayToBlock(io.prestosql.plugin.postgresql.TypeUtils.jdbcObjectArrayToBlock) DynamicSliceOutput(io.airlift.slice.DynamicSliceOutput) OptionalLong(java.util.OptionalLong) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) SQLException(java.sql.SQLException) VARCHAR(io.prestosql.spi.type.VarcharType.VARCHAR) ImmutableList(com.google.common.collect.ImmutableList) Verify.verify(com.google.common.base.Verify.verify) TypeUtils.toBoxedArray(io.prestosql.plugin.postgresql.TypeUtils.toBoxedArray) Block(io.prestosql.spi.block.Block) VerifyException(com.google.common.base.VerifyException) OutputStream(java.io.OutputStream) PgConnection(org.postgresql.jdbc.PgConnection) JsonParser(com.fasterxml.jackson.core.JsonParser) UTF_8(java.nio.charset.StandardCharsets.UTF_8) BaseJdbcConfig(io.prestosql.plugin.jdbc.BaseJdbcConfig) ConnectorTableHandle(io.prestosql.spi.connector.ConnectorTableHandle) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) TypeManager(io.prestosql.spi.type.TypeManager) IOException(java.io.IOException) StatsCollecting(io.prestosql.plugin.jdbc.StatsCollecting) InputStreamReader(java.io.InputStreamReader) ConnectorTableMetadata(io.prestosql.spi.connector.ConnectorTableMetadata) BaseJdbcClient(io.prestosql.plugin.jdbc.BaseJdbcClient) JsonFactory(com.fasterxml.jackson.core.JsonFactory) BooleanWriteFunction(io.prestosql.plugin.jdbc.BooleanWriteFunction) BlockReadFunction(io.prestosql.plugin.jdbc.BlockReadFunction) ColumnHandle(io.prestosql.spi.connector.ColumnHandle) SIZE_OF_LONG(io.airlift.slice.SizeOf.SIZE_OF_LONG) TypeUtils.getJdbcObjectArray(io.prestosql.plugin.postgresql.TypeUtils.getJdbcObjectArray) DoubleWriteFunction(io.prestosql.plugin.jdbc.DoubleWriteFunction) JdbcTableHandle(io.prestosql.plugin.jdbc.JdbcTableHandle) BooleanWriteFunction(io.prestosql.plugin.jdbc.BooleanWriteFunction) Type(io.prestosql.spi.type.Type) ArrayType(io.prestosql.spi.type.ArrayType) VerifyException(com.google.common.base.VerifyException) SliceWriteFunction(io.prestosql.plugin.jdbc.SliceWriteFunction) BlockWriteFunction(io.prestosql.plugin.jdbc.BlockWriteFunction) LongWriteFunction(io.prestosql.plugin.jdbc.LongWriteFunction) DoubleWriteFunction(io.prestosql.plugin.jdbc.DoubleWriteFunction) WriteFunction(io.prestosql.plugin.jdbc.WriteFunction) BooleanWriteFunction(io.prestosql.plugin.jdbc.BooleanWriteFunction) Slice(io.airlift.slice.Slice) WriteNullFunction(io.prestosql.plugin.jdbc.WriteNullFunction) BlockWriteFunction(io.prestosql.plugin.jdbc.BlockWriteFunction) WriteMapping(io.prestosql.plugin.jdbc.WriteMapping)

Aggregations

VerifyException (com.google.common.base.VerifyException)3 Slice (io.airlift.slice.Slice)3 BlockWriteFunction (io.prestosql.plugin.jdbc.BlockWriteFunction)3 BooleanWriteFunction (io.prestosql.plugin.jdbc.BooleanWriteFunction)3 DoubleWriteFunction (io.prestosql.plugin.jdbc.DoubleWriteFunction)3 JdbcColumnHandle (io.prestosql.plugin.jdbc.JdbcColumnHandle)3 LongWriteFunction (io.prestosql.plugin.jdbc.LongWriteFunction)3 SliceWriteFunction (io.prestosql.plugin.jdbc.SliceWriteFunction)3 WriteFunction (io.prestosql.plugin.jdbc.WriteFunction)3 Strings.isNullOrEmpty (com.google.common.base.Strings.isNullOrEmpty)2 Verify.verify (com.google.common.base.Verify.verify)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 Logger (io.airlift.log.Logger)2 BaseJdbcClient (io.prestosql.plugin.jdbc.BaseJdbcClient)2 BaseJdbcConfig (io.prestosql.plugin.jdbc.BaseJdbcConfig)2 ColumnMapping (io.prestosql.plugin.jdbc.ColumnMapping)2 ConnectionFactory (io.prestosql.plugin.jdbc.ConnectionFactory)2 JDBC_ERROR (io.prestosql.plugin.jdbc.JdbcErrorCode.JDBC_ERROR)2