presto-main/src/main/java/io/prestosql/type/DecimalSaturatedFloorCasts.java/DecimalSaturatedFloorCasts/decimalToGenericIntegerTypeSaturatedFloorCast
class DecimalSaturatedFloorCasts:    private static SqlScalarFunction decimalToGenericIntegerTypeSaturatedFloorCast(Type type, long minValue, long maxValue)
    {
        return SqlScalarFunction.builder(DecimalSaturatedFloorCasts.class)
                .signature(Signature.builder()
                        .kind(SCALAR)
                        .operatorType(SATURATED_FLOOR_CAST)
                        .argumentTypes(new TypeSignature("decimal", typeVariable("source_precision"), typeVariable("source_scale")))
                        .returnType(type.getTypeSignature())
                        .build())
                .deterministic(true)
                .choice(choice -> choice
                        .implementation(methodsGroup -> methodsGroup
                                .methods("shortDecimalToGenericIntegerType", "longDecimalToGenericIntegerType")
                                .withExtraParameters((context) -> {
                                    int sourceScale = toIntExact(context.getLiteral("source_scale"));
                                    return ImmutableList.of(sourceScale, minValue, maxValue);
                                })))
                .build();
    }