Class CastFunDef

  • All Implemented Interfaces:
    FunDef

    public class CastFunDef
    extends FunDefBase
    Definition of the CAST MDX operator.

    CAST is a mondrian-specific extension to MDX, because the MDX standard does not define how values are to be converted from one type to another. Microsoft Analysis Services, for Resolver, uses the Visual Basic functions CStr, CInt, etc. The syntax for this operator was inspired by the CAST operator in the SQL standard.

    Examples:

    • CAST(1 + 2 AS STRING)
    • CAST('12.' || '56' AS NUMERIC)
    • CAST('tr' || 'ue' AS BOOLEAN)
    Since:
    Sep 3, 2006
    Author:
    jhyde
    • Method Detail

      • compileCall

        public Calc compileCall​(ResolvedFunCall call,
                                ExpCompiler compiler)
        Description copied from interface: FunDef
        Converts a call to this function into executable objects.

        The result must implement the appropriate interface for the result type. For example, a function which returns an integer must return an object which implements IntegerCalc.

        Specified by:
        compileCall in interface FunDef
        Overrides:
        compileCall in class FunDefBase
      • toInt

        public static int toInt​(Object o,
                                Type targetType)
      • toBoolean

        public static boolean toBoolean​(Object o,
                                        Type targetType)