use of io.trino.plugin.deltalake.DeltaLakeTableHandle in project trino by trinodb.
the class TestDeltaLakeMetastoreStatistics method testStatisticsNaNWithMultipleFiles.
@Test
public void testStatisticsNaNWithMultipleFiles() {
// Stats with NaN values cannot be used. This transaction combines a file with NaN min/max values with one with 0.0 min/max values
DeltaLakeTableHandle tableHandle = registerTable("nan_multi_file");
TableStatistics stats = deltaLakeMetastore.getTableStatistics(SESSION, tableHandle, Constraint.alwaysTrue());
ColumnStatistics columnStatistics = stats.getColumnStatistics().get(COLUMN_HANDLE);
assertEquals(columnStatistics.getRange(), Optional.empty());
}
use of io.trino.plugin.deltalake.DeltaLakeTableHandle in project trino by trinodb.
the class TestDeltaLakeMetastoreStatistics method testStatisticsZeroAndNegativeInfinity.
@Test
public void testStatisticsZeroAndNegativeInfinity() {
DeltaLakeTableHandle tableHandle = registerTable("zero_negative_infinity");
TableStatistics stats = deltaLakeMetastore.getTableStatistics(SESSION, tableHandle, Constraint.alwaysTrue());
ColumnStatistics columnStatistics = stats.getColumnStatistics().get(COLUMN_HANDLE);
assertEquals(columnStatistics.getRange().get().getMin(), NEGATIVE_INFINITY);
assertEquals(columnStatistics.getRange().get().getMax(), 0.0);
}
use of io.trino.plugin.deltalake.DeltaLakeTableHandle in project trino by trinodb.
the class TestDeltaLakeMetastoreStatistics method testStatisticsZeroAndNaN.
@Test
public void testStatisticsZeroAndNaN() {
// Stats with NaN values cannot be used
DeltaLakeTableHandle tableHandle = registerTable("zero_nan");
TableStatistics stats = deltaLakeMetastore.getTableStatistics(SESSION, tableHandle, Constraint.alwaysTrue());
ColumnStatistics columnStatistics = stats.getColumnStatistics().get(COLUMN_HANDLE);
assertEquals(columnStatistics.getRange().get().getMin(), 0.0);
assertEquals(columnStatistics.getRange().get().getMax(), POSITIVE_INFINITY);
}
use of io.trino.plugin.deltalake.DeltaLakeTableHandle in project trino by trinodb.
the class TestDeltaLakeMetastoreStatistics method testStatisticsZeroAndInfinity.
@Test
public void testStatisticsZeroAndInfinity() {
DeltaLakeTableHandle tableHandle = registerTable("zero_infinity");
TableStatistics stats = deltaLakeMetastore.getTableStatistics(SESSION, tableHandle, Constraint.alwaysTrue());
ColumnStatistics columnStatistics = stats.getColumnStatistics().get(COLUMN_HANDLE);
assertEquals(columnStatistics.getRange().get().getMin(), 0.0);
assertEquals(columnStatistics.getRange().get().getMax(), POSITIVE_INFINITY);
}
use of io.trino.plugin.deltalake.DeltaLakeTableHandle in project trino by trinodb.
the class TestDeltaLakeMetastoreStatistics method testStatisticsMultipleFiles.
@Test
public void testStatisticsMultipleFiles() {
DeltaLakeTableHandle tableHandle = registerTable("basic_multi_file");
TableStatistics stats = deltaLakeMetastore.getTableStatistics(SESSION, tableHandle, Constraint.alwaysTrue());
ColumnStatistics columnStatistics = stats.getColumnStatistics().get(COLUMN_HANDLE);
assertEquals(columnStatistics.getRange().get().getMin(), -42.0);
assertEquals(columnStatistics.getRange().get().getMax(), 42.0);
DeltaLakeTableHandle tableHandleWithUnenforcedConstraint = new DeltaLakeTableHandle(tableHandle.getSchemaName(), tableHandle.getTableName(), tableHandle.getLocation(), Optional.of(tableHandle.getMetadataEntry()), TupleDomain.all(), TupleDomain.withColumnDomains(ImmutableMap.of((DeltaLakeColumnHandle) COLUMN_HANDLE, Domain.singleValue(DOUBLE, 42.0))), tableHandle.getWriteType(), tableHandle.getProjectedColumns(), tableHandle.getUpdatedColumns(), tableHandle.getUpdateRowIdColumns(), tableHandle.getAnalyzeHandle(), 0);
stats = deltaLakeMetastore.getTableStatistics(SESSION, tableHandleWithUnenforcedConstraint, Constraint.alwaysTrue());
columnStatistics = stats.getColumnStatistics().get(COLUMN_HANDLE);
assertEquals(columnStatistics.getRange().get().getMin(), 0.0);
assertEquals(columnStatistics.getRange().get().getMax(), 42.0);
}
Aggregations