Skip to content

Commit

Permalink
Support decimal columns in Tpch statistics provider
Browse files Browse the repository at this point in the history
  • Loading branch information
arhimondr authored and findepi committed Feb 26, 2022
1 parent e9f8fa7 commit ebf2852
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import io.trino.spi.statistics.Estimate;
import io.trino.spi.statistics.TableStatistics;
import io.trino.spi.statistics.TableStatisticsMetadata;
import io.trino.spi.type.DecimalType;
import io.trino.spi.type.Type;
import io.trino.spi.type.VarcharType;
import io.trino.tpch.Distributions;
Expand Down Expand Up @@ -368,7 +369,7 @@ private static double toDouble(Object value, Type columnType)
if (columnType.equals(BIGINT) || columnType.equals(INTEGER) || columnType.equals(DATE)) {
return ((Number) value).longValue();
}
if (columnType.equals(DOUBLE)) {
if (columnType.equals(DOUBLE) || columnType instanceof DecimalType) {
return ((Number) value).doubleValue();
}
}
Expand Down

0 comments on commit ebf2852

Please sign in to comment.