Class PigRelUdfConverter


  • class PigRelUdfConverter
    extends java.lang.Object
    This class maps a Pig UDF to a corresponding SQL built-in function/operator. If such mapping is not available, it creates a wrapper to allow SQL engines call Pig UDFs directly.
    • Field Detail

      • PIG_UDF_FINDER

        private static final PigUdfFinder PIG_UDF_FINDER
      • BUILTIN_FUNC

        private static final java.util.Map<java.lang.String,​SqlOperator> BUILTIN_FUNC
      • BUILTIN_AGG_FUNC

        private static final java.util.Map<java.lang.String,​SqlAggFunction> BUILTIN_AGG_FUNC
    • Constructor Detail

      • PigRelUdfConverter

        private PigRelUdfConverter()
    • Method Detail

      • convertPigFunction

        static RexNode convertPigFunction​(PigRelBuilder builder,
                                          org.apache.pig.FuncSpec pigFunc,
                                          com.google.common.collect.ImmutableList<RexNode> operands,
                                          RelDataType returnType)
                                   throws org.apache.pig.impl.logicalLayer.FrontendException
        Converts a Pig UDF, given its FuncSpec and a list of relational operands (function arguments). To call this function, the arguments of Pig functions need to be converted into the relational types before.
        Parameters:
        builder - The relational builder
        pigFunc - Pig function description
        operands - Relational operands for the function
        returnType - Function return data type
        Returns:
        The SQL calls equivalent to the Pig function
        Throws:
        org.apache.pig.impl.logicalLayer.FrontendException
      • getSqlAggFuncForPigUdf

        static SqlAggFunction getSqlAggFuncForPigUdf​(RexCall call)
        Gets the SqlAggFunction for the corresponding Pig aggregate UDF call; returns null for invalid rex call.
        Parameters:
        call - Pig aggregate UDF call