3030
3131import java .util .OptionalDouble ;
3232
33+ import static io .prestosql .spi .type .DoubleType .DOUBLE ;
3334import static java .util .Collections .singletonList ;
3435
3536final 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