Search in sources :

Example 36 with PartitionStatistics

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

the class TestHiveGlueMetastore method testStatisticsLongColumnNames.

@Test
public void testStatisticsLongColumnNames() throws Exception {
    SchemaTableName tableName = temporaryTable("test_statistics_long_column_name");
    try {
        String columnName1 = String.join("", Collections.nCopies(255, "x"));
        String columnName2 = String.join("", Collections.nCopies(255, "ӆ"));
        String columnName3 = String.join("", Collections.nCopies(255, "ö"));
        List<ColumnMetadata> columns = List.of(new ColumnMetadata(columnName1, BIGINT), new ColumnMetadata(columnName2, BIGINT), new ColumnMetadata(columnName3, BIGINT));
        Map<String, HiveColumnStatistics> columnStatistics = Map.of(columnName1, INTEGER_COLUMN_STATISTICS, columnName2, INTEGER_COLUMN_STATISTICS, columnName3, INTEGER_COLUMN_STATISTICS);
        PartitionStatistics partitionStatistics = PartitionStatistics.builder().setBasicStatistics(HIVE_BASIC_STATISTICS).setColumnStatistics(columnStatistics).build();
        doCreateEmptyTable(tableName, ORC, columns);
        assertThat(metastore.getTableStatistics(tableName.getSchemaName(), tableName.getTableName())).isEqualTo(EMPTY_TABLE_STATISTICS);
        testUpdateTableStatistics(tableName, EMPTY_TABLE_STATISTICS, partitionStatistics);
    } finally {
        dropTable(tableName);
    }
}
Also used : ColumnMetadata(io.trino.spi.connector.ColumnMetadata) PartitionStatistics(io.trino.plugin.hive.PartitionStatistics) HiveColumnStatistics(io.trino.plugin.hive.metastore.HiveColumnStatistics) SchemaTableName(io.trino.spi.connector.SchemaTableName) Test(org.testng.annotations.Test)

Aggregations

PartitionStatistics (io.trino.plugin.hive.PartitionStatistics)36 SchemaTableName (io.trino.spi.connector.SchemaTableName)21 HiveBasicStatistics (io.trino.plugin.hive.HiveBasicStatistics)16 HiveColumnStatistics (io.trino.plugin.hive.metastore.HiveColumnStatistics)16 TrinoException (io.trino.spi.TrinoException)15 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)13 ImmutableMap (com.google.common.collect.ImmutableMap)13 List (java.util.List)12 Map (java.util.Map)11 OptionalLong (java.util.OptionalLong)11 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)10 ImmutableSet.toImmutableSet (com.google.common.collect.ImmutableSet.toImmutableSet)10 TableNotFoundException (io.trino.spi.connector.TableNotFoundException)10 Type (io.trino.spi.type.Type)10 ArrayList (java.util.ArrayList)10 Objects.requireNonNull (java.util.Objects.requireNonNull)10 Optional (java.util.Optional)10 Set (java.util.Set)10 ImmutableList (com.google.common.collect.ImmutableList)9 PartitionNotFoundException (io.trino.plugin.hive.PartitionNotFoundException)8