Search in sources :

Example 1 with HiveTypeName

use of io.trino.plugin.hive.HiveTypeName in project trino by trinodb.

the class AcidSchema method createAcidSchema.

public static Properties createAcidSchema(HiveType rowType) {
    Properties hiveAcidSchema = new Properties();
    hiveAcidSchema.setProperty(IOConstants.COLUMNS, String.join(",", ACID_COLUMN_NAMES));
    // We must supply an accurate row type, because Apache ORC code we don't control has a consistency
    // check that the layout of this "row" must agree with the layout of an inserted row.
    hiveAcidSchema.setProperty(IOConstants.COLUMNS_TYPES, createAcidColumnHiveTypes(rowType).stream().map(HiveType::getHiveTypeName).map(HiveTypeName::toString).collect(joining(":")));
    return hiveAcidSchema;
}
Also used : HiveTypeName(io.trino.plugin.hive.HiveTypeName) Properties(java.util.Properties)

Example 2 with HiveTypeName

use of io.trino.plugin.hive.HiveTypeName in project trino by trinodb.

the class AbstractFileFormat method createSchema.

static Properties createSchema(HiveStorageFormat format, List<String> columnNames, List<Type> columnTypes) {
    Properties schema = new Properties();
    schema.setProperty(SERIALIZATION_LIB, format.getSerde());
    schema.setProperty(FILE_INPUT_FORMAT, format.getInputFormat());
    schema.setProperty(META_TABLE_COLUMNS, join(",", columnNames));
    schema.setProperty(META_TABLE_COLUMN_TYPES, columnTypes.stream().map(HiveType::toHiveType).map(HiveType::getHiveTypeName).map(HiveTypeName::toString).collect(joining(":")));
    return schema;
}
Also used : HiveTypeName(io.trino.plugin.hive.HiveTypeName) Properties(java.util.Properties) HiveType(io.trino.plugin.hive.HiveType) HiveType.toHiveType(io.trino.plugin.hive.HiveType.toHiveType)

Example 3 with HiveTypeName

use of io.trino.plugin.hive.HiveTypeName in project trino by trinodb.

the class CheckpointWriter method buildSchemaProperties.

private static Properties buildSchemaProperties(List<String> columnNames, List<Type> columnTypes) {
    // TODO copied out from DeltaLakePageSink. Extrat to utility class
    Properties schema = new Properties();
    schema.setProperty(IOConstants.COLUMNS, String.join(",", columnNames));
    schema.setProperty(IOConstants.COLUMNS_TYPES, columnTypes.stream().map(DeltaHiveTypeTranslator::toHiveType).map(HiveType::getHiveTypeName).map(HiveTypeName::toString).collect(joining(":")));
    return schema;
}
Also used : HiveTypeName(io.trino.plugin.hive.HiveTypeName) Properties(java.util.Properties) DeltaHiveTypeTranslator(io.trino.plugin.deltalake.DeltaHiveTypeTranslator)

Example 4 with HiveTypeName

use of io.trino.plugin.hive.HiveTypeName in project trino by trinodb.

the class DeltaLakePageSink method buildSchemaProperties.

static Properties buildSchemaProperties(List<String> columnNames, List<Type> columnTypes) {
    Properties schema = new Properties();
    schema.setProperty(IOConstants.COLUMNS, String.join(",", columnNames));
    schema.setProperty(IOConstants.COLUMNS_TYPES, columnTypes.stream().map(DeltaHiveTypeTranslator::toHiveType).map(HiveType::getHiveTypeName).map(HiveTypeName::toString).collect(joining(":")));
    return schema;
}
Also used : HiveTypeName(io.trino.plugin.hive.HiveTypeName) Properties(java.util.Properties)

Aggregations

HiveTypeName (io.trino.plugin.hive.HiveTypeName)4 Properties (java.util.Properties)4 DeltaHiveTypeTranslator (io.trino.plugin.deltalake.DeltaHiveTypeTranslator)1 HiveType (io.trino.plugin.hive.HiveType)1 HiveType.toHiveType (io.trino.plugin.hive.HiveType.toHiveType)1