Search in sources :

Example 1 with SCALAR

use of com.facebook.presto.spi.function.FunctionKind.SCALAR in project presto by prestodb.

the class TestPolymorphicScalarFunction method testSetsHiddenToTrueForOperators.

@Test
public void testSetsHiddenToTrueForOperators() {
    Signature signature = SignatureBuilder.builder().operatorType(ADD).kind(SCALAR).returnType(parseTypeSignature("varchar(x)", ImmutableSet.of("x"))).argumentTypes(parseTypeSignature("varchar(x)", ImmutableSet.of("x"))).build();
    SqlScalarFunction function = SqlScalarFunction.builder(TestMethods.class, ADD).signature(signature).deterministic(true).choice(choice -> choice.implementation(methodsGroup -> methodsGroup.methods("varcharToVarchar"))).build();
    BuiltInScalarFunctionImplementation functionImplementation = function.specialize(BOUND_VARIABLES, 1, FUNCTION_AND_TYPE_MANAGER);
}
Also used : StandardTypes(com.facebook.presto.common.type.StandardTypes) Slice(io.airlift.slice.Slice) Assert.assertEquals(org.testng.Assert.assertEquals) Test(org.testng.annotations.Test) IS_DISTINCT_FROM(com.facebook.presto.common.function.OperatorType.IS_DISTINCT_FROM) FunctionAndTypeManager.createTestFunctionAndTypeManager(com.facebook.presto.metadata.FunctionAndTypeManager.createTestFunctionAndTypeManager) TypeSignature(com.facebook.presto.common.type.TypeSignature) MAX_SHORT_PRECISION(com.facebook.presto.common.type.Decimals.MAX_SHORT_PRECISION) ADD(com.facebook.presto.common.function.OperatorType.ADD) ImmutableList(com.google.common.collect.ImmutableList) Arrays.asList(java.util.Arrays.asList) Slices(io.airlift.slice.Slices) Math.toIntExact(java.lang.Math.toIntExact) VARCHAR_TO_VARCHAR_RETURN_VALUE(com.facebook.presto.metadata.TestPolymorphicScalarFunction.TestMethods.VARCHAR_TO_VARCHAR_RETURN_VALUE) Assert.assertFalse(org.testng.Assert.assertFalse) BOOLEAN(com.facebook.presto.common.type.StandardTypes.BOOLEAN) BuiltInScalarFunctionImplementation(com.facebook.presto.operator.scalar.BuiltInScalarFunctionImplementation) ImmutableSet(com.google.common.collect.ImmutableSet) Signature.comparableWithVariadicBound(com.facebook.presto.spi.function.Signature.comparableWithVariadicBound) ImmutableMap(com.google.common.collect.ImmutableMap) LongArrayBlock(com.facebook.presto.common.block.LongArrayBlock) BLOCK_AND_POSITION(com.facebook.presto.operator.scalar.ScalarFunctionImplementationChoice.NullConvention.BLOCK_AND_POSITION) USE_NULL_FLAG(com.facebook.presto.operator.scalar.ScalarFunctionImplementationChoice.NullConvention.USE_NULL_FLAG) SCALAR(com.facebook.presto.spi.function.FunctionKind.SCALAR) VARCHAR(com.facebook.presto.common.type.StandardTypes.VARCHAR) ArgumentProperty.valueTypeArgumentProperty(com.facebook.presto.operator.scalar.ScalarFunctionImplementationChoice.ArgumentProperty.valueTypeArgumentProperty) TypeSignature.parseTypeSignature(com.facebook.presto.common.type.TypeSignature.parseTypeSignature) VARCHAR_TO_BIGINT_RETURN_VALUE(com.facebook.presto.metadata.TestPolymorphicScalarFunction.TestMethods.VARCHAR_TO_BIGINT_RETURN_VALUE) Signature(com.facebook.presto.spi.function.Signature) Optional(java.util.Optional) Assert.assertTrue(org.testng.Assert.assertTrue) Block(com.facebook.presto.common.block.Block) Collections(java.util.Collections) BuiltInScalarFunctionImplementation(com.facebook.presto.operator.scalar.BuiltInScalarFunctionImplementation) TypeSignature(com.facebook.presto.common.type.TypeSignature) TypeSignature.parseTypeSignature(com.facebook.presto.common.type.TypeSignature.parseTypeSignature) Signature(com.facebook.presto.spi.function.Signature) Test(org.testng.annotations.Test)

Example 2 with SCALAR

use of com.facebook.presto.spi.function.FunctionKind.SCALAR in project presto by prestodb.

the class HiveScalarFunctionInvoker method createFunctionInvoker.

public static HiveScalarFunctionInvoker createFunctionInvoker(Class<?> cls, QualifiedObjectName name, List<TypeSignature> arguments, TypeManager typeManager) {
    final List<Type> argumentTypes = arguments.stream().map(typeManager::getType).collect(Collectors.toList());
    try {
        // Step 1: Create function instance
        final GenericUDF udf = createGenericUDF(name, cls);
        // Step 2: Initialize function
        ObjectInspector[] inputInspectors = argumentTypes.stream().map(argumentType -> ObjectInspectors.create(argumentType, typeManager)).toArray(ObjectInspector[]::new);
        ObjectInspector resultInspector = udf.initialize(inputInspectors);
        // Step 3: Create invoker
        Type resultType = PrestoTypes.fromObjectInspector(resultInspector, typeManager);
        ObjectInputDecoder[] argumentDecoders = argumentTypes.stream().map(argumentsType -> createDecoder(argumentsType, typeManager)).toArray(ObjectInputDecoder[]::new);
        ObjectEncoder resultEncoder = createEncoder(resultType, resultInspector);
        Signature signature = new Signature(name, SCALAR, resultType.getTypeSignature(), arguments);
        // Step 4: Create ThreadLocal GenericUDF
        final ThreadLocal<GenericUDF> genericUDFSupplier = ThreadLocal.withInitial(() -> {
            try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(cls.getClassLoader())) {
                GenericUDF ret = createGenericUDF(name, cls);
                ret.initialize(inputInspectors);
                return ret;
            } catch (Exception e) {
                throw initializationError(e);
            }
        });
        return new HiveScalarFunctionInvoker(signature, genericUDFSupplier::get, argumentDecoders, resultEncoder);
    } catch (Exception e) {
        throw initializationError(e);
    }
}
Also used : Constructor(java.lang.reflect.Constructor) Supplier(java.util.function.Supplier) TypeSignature(com.facebook.presto.common.type.TypeSignature) DeferredObject(org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject) UDF(org.apache.hadoop.hive.ql.exec.UDF) DeferredJavaObject(org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject) ObjectEncoders.createEncoder(com.facebook.presto.hive.functions.type.ObjectEncoders.createEncoder) TypeManager(com.facebook.presto.common.type.TypeManager) HiveFunctionErrorCode.initializationError(com.facebook.presto.hive.functions.HiveFunctionErrorCode.initializationError) Objects.requireNonNull(java.util.Objects.requireNonNull) QualifiedObjectName(com.facebook.presto.common.QualifiedObjectName) ThreadContextClassLoader(com.facebook.presto.spi.classloader.ThreadContextClassLoader) ObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector) Type(com.facebook.presto.common.type.Type) GenericUDF(org.apache.hadoop.hive.ql.udf.generic.GenericUDF) ObjectInputDecoders.createDecoder(com.facebook.presto.hive.functions.type.ObjectInputDecoders.createDecoder) ObjectInputDecoder(com.facebook.presto.hive.functions.type.ObjectInputDecoder) GenericUDFBridge(org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge) PrestoTypes(com.facebook.presto.hive.functions.type.PrestoTypes) Collectors(java.util.stream.Collectors) SCALAR(com.facebook.presto.spi.function.FunctionKind.SCALAR) InvocationTargetException(java.lang.reflect.InvocationTargetException) HiveFunctionErrorCode.unsupportedFunctionType(com.facebook.presto.hive.functions.HiveFunctionErrorCode.unsupportedFunctionType) List(java.util.List) ObjectEncoder(com.facebook.presto.hive.functions.type.ObjectEncoder) ObjectInspectors(com.facebook.presto.hive.functions.type.ObjectInspectors) Signature(com.facebook.presto.spi.function.Signature) HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) HiveFunctionErrorCode.executionError(com.facebook.presto.hive.functions.HiveFunctionErrorCode.executionError) ObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector) InvocationTargetException(java.lang.reflect.InvocationTargetException) HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) Type(com.facebook.presto.common.type.Type) HiveFunctionErrorCode.unsupportedFunctionType(com.facebook.presto.hive.functions.HiveFunctionErrorCode.unsupportedFunctionType) GenericUDF(org.apache.hadoop.hive.ql.udf.generic.GenericUDF) ObjectInputDecoder(com.facebook.presto.hive.functions.type.ObjectInputDecoder) TypeSignature(com.facebook.presto.common.type.TypeSignature) Signature(com.facebook.presto.spi.function.Signature) ObjectEncoder(com.facebook.presto.hive.functions.type.ObjectEncoder) ThreadContextClassLoader(com.facebook.presto.spi.classloader.ThreadContextClassLoader)

Example 3 with SCALAR

use of com.facebook.presto.spi.function.FunctionKind.SCALAR in project presto by prestodb.

the class DecimalOperators method decimalDivideOperator.

private static SqlScalarFunction decimalDivideOperator() {
    TypeSignature decimalLeftSignature = parseTypeSignature("decimal(a_precision, a_scale)", ImmutableSet.of("a_precision", "a_scale"));
    TypeSignature decimalRightSignature = parseTypeSignature("decimal(b_precision, b_scale)", ImmutableSet.of("b_precision", "b_scale"));
    TypeSignature decimalResultSignature = parseTypeSignature("decimal(r_precision, r_scale)", ImmutableSet.of("r_precision", "r_scale"));
    // we extend target precision by b_scale. This is upper bound on how much division result will grow.
    // pessimistic case is a / 0.0000001
    // if scale of divisor is greater than scale of dividend we extend scale further as we
    // want result scale to be maximum of scales of divisor and dividend.
    Signature signature = SignatureBuilder.builder().kind(SCALAR).operatorType(DIVIDE).longVariableConstraints(longVariableExpression("r_precision", "min(38, a_precision + b_scale + max(b_scale - a_scale, 0))"), longVariableExpression("r_scale", "max(a_scale, b_scale)")).argumentTypes(decimalLeftSignature, decimalRightSignature).returnType(decimalResultSignature).build();
    return SqlScalarFunction.builder(DecimalOperators.class, DIVIDE).signature(signature).deterministic(true).choice(choice -> choice.implementation(methodsGroup -> methodsGroup.methods("divideShortShortShort", "divideShortLongShort", "divideLongShortShort", "divideShortShortLong", "divideLongLongLong", "divideShortLongLong", "divideLongShortLong").withExtraParameters(DecimalOperators::divideRescaleFactor))).build();
}
Also used : SUBTRACT(com.facebook.presto.common.function.OperatorType.SUBTRACT) INDETERMINATE(com.facebook.presto.common.function.OperatorType.INDETERMINATE) UnscaledDecimal128Arithmetic.throwIfOverflows(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.throwIfOverflows) UnscaledDecimal128Arithmetic.unscaledDecimalToUnscaledLong(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.unscaledDecimalToUnscaledLong) Math.abs(java.lang.Math.abs) TypeSignature(com.facebook.presto.common.type.TypeSignature) ADD(com.facebook.presto.common.function.OperatorType.ADD) ScalarOperator(com.facebook.presto.spi.function.ScalarOperator) DIVIDE(com.facebook.presto.common.function.OperatorType.DIVIDE) BigInteger(java.math.BigInteger) LiteralParameters(com.facebook.presto.spi.function.LiteralParameters) UsedByGeneratedCode(com.facebook.presto.annotation.UsedByGeneratedCode) Long.signum(java.lang.Long.signum) HASH_CODE(com.facebook.presto.common.function.OperatorType.HASH_CODE) ImmutableSet(com.google.common.collect.ImmutableSet) UnscaledDecimal128Arithmetic.remainder(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.remainder) NEGATION(com.facebook.presto.common.function.OperatorType.NEGATION) UnscaledDecimal128Arithmetic.rescale(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.rescale) SCALAR(com.facebook.presto.spi.function.FunctionKind.SCALAR) List(java.util.List) UnscaledDecimal128Arithmetic(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic) PolymorphicScalarFunctionBuilder(com.facebook.presto.metadata.PolymorphicScalarFunctionBuilder) SqlType(com.facebook.presto.spi.function.SqlType) StandardTypes(com.facebook.presto.common.type.StandardTypes) DecimalType(com.facebook.presto.common.type.DecimalType) Slice(io.airlift.slice.Slice) DIVISION_BY_ZERO(com.facebook.presto.spi.StandardErrorCode.DIVISION_BY_ZERO) Decimals.encodeUnscaledValue(com.facebook.presto.common.type.Decimals.encodeUnscaledValue) MULTIPLY(com.facebook.presto.common.function.OperatorType.MULTIPLY) PrestoException(com.facebook.presto.spi.PrestoException) UnscaledDecimal128Arithmetic.isZero(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.isZero) ImmutableList(com.google.common.collect.ImmutableList) UnscaledDecimal128Arithmetic.divideRoundUp(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.divideRoundUp) UnscaledDecimal128Arithmetic.unscaledDecimal(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.unscaledDecimal) Objects.requireNonNull(java.util.Objects.requireNonNull) Math.toIntExact(java.lang.Math.toIntExact) Decimals.longTenToNth(com.facebook.presto.common.type.Decimals.longTenToNth) SqlScalarFunction(com.facebook.presto.metadata.SqlScalarFunction) Signature.longVariableExpression(com.facebook.presto.spi.function.Signature.longVariableExpression) XxHash64(io.airlift.slice.XxHash64) Decimals(com.facebook.presto.common.type.Decimals) SpecializeContext(com.facebook.presto.metadata.PolymorphicScalarFunctionBuilder.SpecializeContext) Integer.max(java.lang.Integer.max) NUMERIC_VALUE_OUT_OF_RANGE(com.facebook.presto.spi.StandardErrorCode.NUMERIC_VALUE_OUT_OF_RANGE) TypeSignature.parseTypeSignature(com.facebook.presto.common.type.TypeSignature.parseTypeSignature) IsNull(com.facebook.presto.spi.function.IsNull) Signature(com.facebook.presto.spi.function.Signature) MODULUS(com.facebook.presto.common.function.OperatorType.MODULUS) SignatureBuilder(com.facebook.presto.metadata.SignatureBuilder) XX_HASH_64(com.facebook.presto.common.function.OperatorType.XX_HASH_64) TypeSignature(com.facebook.presto.common.type.TypeSignature) TypeSignature.parseTypeSignature(com.facebook.presto.common.type.TypeSignature.parseTypeSignature) TypeSignature(com.facebook.presto.common.type.TypeSignature) TypeSignature.parseTypeSignature(com.facebook.presto.common.type.TypeSignature.parseTypeSignature) Signature(com.facebook.presto.spi.function.Signature)

Example 4 with SCALAR

use of com.facebook.presto.spi.function.FunctionKind.SCALAR in project presto by prestodb.

the class DecimalOperators method decimalSubtractOperator.

private static SqlScalarFunction decimalSubtractOperator() {
    TypeSignature decimalLeftSignature = parseTypeSignature("decimal(a_precision, a_scale)", ImmutableSet.of("a_precision", "a_scale"));
    TypeSignature decimalRightSignature = parseTypeSignature("decimal(b_precision, b_scale)", ImmutableSet.of("b_precision", "b_scale"));
    TypeSignature decimalResultSignature = parseTypeSignature("decimal(r_precision, r_scale)", ImmutableSet.of("r_precision", "r_scale"));
    Signature signature = SignatureBuilder.builder().kind(SCALAR).operatorType(SUBTRACT).longVariableConstraints(longVariableExpression("r_precision", "min(38, max(a_precision - a_scale, b_precision - b_scale) + max(a_scale, b_scale) + 1)"), longVariableExpression("r_scale", "max(a_scale, b_scale)")).argumentTypes(decimalLeftSignature, decimalRightSignature).returnType(decimalResultSignature).build();
    return SqlScalarFunction.builder(DecimalOperators.class, SUBTRACT).signature(signature).deterministic(true).choice(choice -> choice.implementation(methodsGroup -> methodsGroup.methods("subtractShortShortShort").withExtraParameters(DecimalOperators::calculateShortRescaleParameters)).implementation(methodsGroup -> methodsGroup.methods("subtractShortShortLong", "subtractLongLongLong", "subtractShortLongLong", "subtractLongShortLong").withExtraParameters(DecimalOperators::calculateLongRescaleParameters))).build();
}
Also used : SUBTRACT(com.facebook.presto.common.function.OperatorType.SUBTRACT) INDETERMINATE(com.facebook.presto.common.function.OperatorType.INDETERMINATE) UnscaledDecimal128Arithmetic.throwIfOverflows(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.throwIfOverflows) UnscaledDecimal128Arithmetic.unscaledDecimalToUnscaledLong(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.unscaledDecimalToUnscaledLong) Math.abs(java.lang.Math.abs) TypeSignature(com.facebook.presto.common.type.TypeSignature) ADD(com.facebook.presto.common.function.OperatorType.ADD) ScalarOperator(com.facebook.presto.spi.function.ScalarOperator) DIVIDE(com.facebook.presto.common.function.OperatorType.DIVIDE) BigInteger(java.math.BigInteger) LiteralParameters(com.facebook.presto.spi.function.LiteralParameters) UsedByGeneratedCode(com.facebook.presto.annotation.UsedByGeneratedCode) Long.signum(java.lang.Long.signum) HASH_CODE(com.facebook.presto.common.function.OperatorType.HASH_CODE) ImmutableSet(com.google.common.collect.ImmutableSet) UnscaledDecimal128Arithmetic.remainder(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.remainder) NEGATION(com.facebook.presto.common.function.OperatorType.NEGATION) UnscaledDecimal128Arithmetic.rescale(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.rescale) SCALAR(com.facebook.presto.spi.function.FunctionKind.SCALAR) List(java.util.List) UnscaledDecimal128Arithmetic(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic) PolymorphicScalarFunctionBuilder(com.facebook.presto.metadata.PolymorphicScalarFunctionBuilder) SqlType(com.facebook.presto.spi.function.SqlType) StandardTypes(com.facebook.presto.common.type.StandardTypes) DecimalType(com.facebook.presto.common.type.DecimalType) Slice(io.airlift.slice.Slice) DIVISION_BY_ZERO(com.facebook.presto.spi.StandardErrorCode.DIVISION_BY_ZERO) Decimals.encodeUnscaledValue(com.facebook.presto.common.type.Decimals.encodeUnscaledValue) MULTIPLY(com.facebook.presto.common.function.OperatorType.MULTIPLY) PrestoException(com.facebook.presto.spi.PrestoException) UnscaledDecimal128Arithmetic.isZero(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.isZero) ImmutableList(com.google.common.collect.ImmutableList) UnscaledDecimal128Arithmetic.divideRoundUp(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.divideRoundUp) UnscaledDecimal128Arithmetic.unscaledDecimal(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.unscaledDecimal) Objects.requireNonNull(java.util.Objects.requireNonNull) Math.toIntExact(java.lang.Math.toIntExact) Decimals.longTenToNth(com.facebook.presto.common.type.Decimals.longTenToNth) SqlScalarFunction(com.facebook.presto.metadata.SqlScalarFunction) Signature.longVariableExpression(com.facebook.presto.spi.function.Signature.longVariableExpression) XxHash64(io.airlift.slice.XxHash64) Decimals(com.facebook.presto.common.type.Decimals) SpecializeContext(com.facebook.presto.metadata.PolymorphicScalarFunctionBuilder.SpecializeContext) Integer.max(java.lang.Integer.max) NUMERIC_VALUE_OUT_OF_RANGE(com.facebook.presto.spi.StandardErrorCode.NUMERIC_VALUE_OUT_OF_RANGE) TypeSignature.parseTypeSignature(com.facebook.presto.common.type.TypeSignature.parseTypeSignature) IsNull(com.facebook.presto.spi.function.IsNull) Signature(com.facebook.presto.spi.function.Signature) MODULUS(com.facebook.presto.common.function.OperatorType.MODULUS) SignatureBuilder(com.facebook.presto.metadata.SignatureBuilder) XX_HASH_64(com.facebook.presto.common.function.OperatorType.XX_HASH_64) TypeSignature(com.facebook.presto.common.type.TypeSignature) TypeSignature.parseTypeSignature(com.facebook.presto.common.type.TypeSignature.parseTypeSignature) TypeSignature(com.facebook.presto.common.type.TypeSignature) TypeSignature.parseTypeSignature(com.facebook.presto.common.type.TypeSignature.parseTypeSignature) Signature(com.facebook.presto.spi.function.Signature)

Example 5 with SCALAR

use of com.facebook.presto.spi.function.FunctionKind.SCALAR in project presto by prestodb.

the class DecimalOperators method decimalAddOperator.

private static SqlScalarFunction decimalAddOperator() {
    TypeSignature decimalLeftSignature = parseTypeSignature("decimal(a_precision, a_scale)", ImmutableSet.of("a_precision", "a_scale"));
    TypeSignature decimalRightSignature = parseTypeSignature("decimal(b_precision, b_scale)", ImmutableSet.of("b_precision", "b_scale"));
    TypeSignature decimalResultSignature = parseTypeSignature("decimal(r_precision, r_scale)", ImmutableSet.of("r_precision", "r_scale"));
    Signature signature = SignatureBuilder.builder().kind(SCALAR).operatorType(ADD).longVariableConstraints(longVariableExpression("r_precision", "min(38, max(a_precision - a_scale, b_precision - b_scale) + max(a_scale, b_scale) + 1)"), longVariableExpression("r_scale", "max(a_scale, b_scale)")).argumentTypes(decimalLeftSignature, decimalRightSignature).returnType(decimalResultSignature).build();
    return SqlScalarFunction.builder(DecimalOperators.class, ADD).signature(signature).deterministic(true).choice(choice -> choice.implementation(methodsGroup -> methodsGroup.methods("addShortShortShort").withExtraParameters(DecimalOperators::calculateShortRescaleParameters)).implementation(methodsGroup -> methodsGroup.methods("addShortShortLong", "addLongLongLong", "addShortLongLong", "addLongShortLong").withExtraParameters(DecimalOperators::calculateLongRescaleParameters))).build();
}
Also used : SUBTRACT(com.facebook.presto.common.function.OperatorType.SUBTRACT) INDETERMINATE(com.facebook.presto.common.function.OperatorType.INDETERMINATE) UnscaledDecimal128Arithmetic.throwIfOverflows(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.throwIfOverflows) UnscaledDecimal128Arithmetic.unscaledDecimalToUnscaledLong(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.unscaledDecimalToUnscaledLong) Math.abs(java.lang.Math.abs) TypeSignature(com.facebook.presto.common.type.TypeSignature) ADD(com.facebook.presto.common.function.OperatorType.ADD) ScalarOperator(com.facebook.presto.spi.function.ScalarOperator) DIVIDE(com.facebook.presto.common.function.OperatorType.DIVIDE) BigInteger(java.math.BigInteger) LiteralParameters(com.facebook.presto.spi.function.LiteralParameters) UsedByGeneratedCode(com.facebook.presto.annotation.UsedByGeneratedCode) Long.signum(java.lang.Long.signum) HASH_CODE(com.facebook.presto.common.function.OperatorType.HASH_CODE) ImmutableSet(com.google.common.collect.ImmutableSet) UnscaledDecimal128Arithmetic.remainder(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.remainder) NEGATION(com.facebook.presto.common.function.OperatorType.NEGATION) UnscaledDecimal128Arithmetic.rescale(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.rescale) SCALAR(com.facebook.presto.spi.function.FunctionKind.SCALAR) List(java.util.List) UnscaledDecimal128Arithmetic(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic) PolymorphicScalarFunctionBuilder(com.facebook.presto.metadata.PolymorphicScalarFunctionBuilder) SqlType(com.facebook.presto.spi.function.SqlType) StandardTypes(com.facebook.presto.common.type.StandardTypes) DecimalType(com.facebook.presto.common.type.DecimalType) Slice(io.airlift.slice.Slice) DIVISION_BY_ZERO(com.facebook.presto.spi.StandardErrorCode.DIVISION_BY_ZERO) Decimals.encodeUnscaledValue(com.facebook.presto.common.type.Decimals.encodeUnscaledValue) MULTIPLY(com.facebook.presto.common.function.OperatorType.MULTIPLY) PrestoException(com.facebook.presto.spi.PrestoException) UnscaledDecimal128Arithmetic.isZero(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.isZero) ImmutableList(com.google.common.collect.ImmutableList) UnscaledDecimal128Arithmetic.divideRoundUp(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.divideRoundUp) UnscaledDecimal128Arithmetic.unscaledDecimal(com.facebook.presto.common.type.UnscaledDecimal128Arithmetic.unscaledDecimal) Objects.requireNonNull(java.util.Objects.requireNonNull) Math.toIntExact(java.lang.Math.toIntExact) Decimals.longTenToNth(com.facebook.presto.common.type.Decimals.longTenToNth) SqlScalarFunction(com.facebook.presto.metadata.SqlScalarFunction) Signature.longVariableExpression(com.facebook.presto.spi.function.Signature.longVariableExpression) XxHash64(io.airlift.slice.XxHash64) Decimals(com.facebook.presto.common.type.Decimals) SpecializeContext(com.facebook.presto.metadata.PolymorphicScalarFunctionBuilder.SpecializeContext) Integer.max(java.lang.Integer.max) NUMERIC_VALUE_OUT_OF_RANGE(com.facebook.presto.spi.StandardErrorCode.NUMERIC_VALUE_OUT_OF_RANGE) TypeSignature.parseTypeSignature(com.facebook.presto.common.type.TypeSignature.parseTypeSignature) IsNull(com.facebook.presto.spi.function.IsNull) Signature(com.facebook.presto.spi.function.Signature) MODULUS(com.facebook.presto.common.function.OperatorType.MODULUS) SignatureBuilder(com.facebook.presto.metadata.SignatureBuilder) XX_HASH_64(com.facebook.presto.common.function.OperatorType.XX_HASH_64) TypeSignature(com.facebook.presto.common.type.TypeSignature) TypeSignature.parseTypeSignature(com.facebook.presto.common.type.TypeSignature.parseTypeSignature) TypeSignature(com.facebook.presto.common.type.TypeSignature) TypeSignature.parseTypeSignature(com.facebook.presto.common.type.TypeSignature.parseTypeSignature) Signature(com.facebook.presto.spi.function.Signature)

Aggregations

TypeSignature (com.facebook.presto.common.type.TypeSignature)9 SCALAR (com.facebook.presto.spi.function.FunctionKind.SCALAR)9 Signature (com.facebook.presto.spi.function.Signature)9 ADD (com.facebook.presto.common.function.OperatorType.ADD)8 StandardTypes (com.facebook.presto.common.type.StandardTypes)8 TypeSignature.parseTypeSignature (com.facebook.presto.common.type.TypeSignature.parseTypeSignature)8 ImmutableList (com.google.common.collect.ImmutableList)8 ImmutableSet (com.google.common.collect.ImmutableSet)8 Slice (io.airlift.slice.Slice)8 Math.toIntExact (java.lang.Math.toIntExact)8 UsedByGeneratedCode (com.facebook.presto.annotation.UsedByGeneratedCode)4 DIVIDE (com.facebook.presto.common.function.OperatorType.DIVIDE)4 HASH_CODE (com.facebook.presto.common.function.OperatorType.HASH_CODE)4 INDETERMINATE (com.facebook.presto.common.function.OperatorType.INDETERMINATE)4 MODULUS (com.facebook.presto.common.function.OperatorType.MODULUS)4 MULTIPLY (com.facebook.presto.common.function.OperatorType.MULTIPLY)4 NEGATION (com.facebook.presto.common.function.OperatorType.NEGATION)4 Block (com.facebook.presto.common.block.Block)3 LongArrayBlock (com.facebook.presto.common.block.LongArrayBlock)3 IS_DISTINCT_FROM (com.facebook.presto.common.function.OperatorType.IS_DISTINCT_FROM)3