Skip to content

Commit 3c8cc38

Browse files
committed
Cleanup StatsUtil
1 parent 1a4f7c0 commit 3c8cc38

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

presto-main/src/main/java/io/prestosql/cost/StatsUtil.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
import java.util.OptionalDouble;
3232

33+
import static io.prestosql.spi.type.DoubleType.DOUBLE;
3334
import static java.util.Collections.singletonList;
3435

3536
final class StatsUtil
@@ -40,7 +41,7 @@ static OptionalDouble toStatsRepresentation(Metadata metadata, Session session,
4041
{
4142
if (convertibleToDoubleWithCast(type)) {
4243
InterpretedFunctionInvoker functionInvoker = new InterpretedFunctionInvoker(metadata);
43-
ResolvedFunction castFunction = metadata.getCoercion(type, DoubleType.DOUBLE);
44+
ResolvedFunction castFunction = metadata.getCoercion(type, DOUBLE);
4445
return OptionalDouble.of((double) functionInvoker.invoke(castFunction, session.toConnectorSession(), singletonList(value)));
4546
}
4647

@@ -54,12 +55,12 @@ static OptionalDouble toStatsRepresentation(Metadata metadata, Session session,
5455
private static boolean convertibleToDoubleWithCast(Type type)
5556
{
5657
return type instanceof DecimalType
57-
|| DoubleType.DOUBLE.equals(type)
58-
|| RealType.REAL.equals(type)
59-
|| BigintType.BIGINT.equals(type)
60-
|| IntegerType.INTEGER.equals(type)
61-
|| SmallintType.SMALLINT.equals(type)
62-
|| TinyintType.TINYINT.equals(type)
63-
|| BooleanType.BOOLEAN.equals(type);
58+
|| type instanceof DoubleType
59+
|| type instanceof RealType
60+
|| type instanceof BigintType
61+
|| type instanceof IntegerType
62+
|| type instanceof SmallintType
63+
|| type instanceof TinyintType
64+
|| type instanceof BooleanType;
6465
}
6566
}

0 commit comments

Comments
 (0)