@BuiltInFunction(name = FloorFunction.NAME, nodeClass = FloorParseNode.class, args = {
/** * Base class for RoundFunction. * */ @BuiltInFunction(name = RoundFunction.NAME, nodeClass = RoundParseNode.class, args = { @Argument(allowedTypes={PTimestamp.class, PDecimal.class}), @Argument(allowedTypes={PVarchar.class, PInteger.class}, defaultValue = "null", isConstant=true), @Argument(allowedTypes={PInteger.class}, defaultValue="1", isConstant=true) }, classType = FunctionParseNode.FunctionClassType.ABSTRACT, derivedFunctions = {RoundDateExpression.class, RoundTimestampExpression.class, RoundDecimalExpression.class} ) public abstract class RoundFunction extends ScalarFunction { public static final String NAME = "ROUND"; public RoundFunction() {} public RoundFunction(List<Expression> children) { super(children); } @Override public String getName() { return NAME; } }
@BuiltInFunction(name = LogFunction.NAME, args = { @Argument(allowedTypes = { PDouble.class, PDecimal.class }), @Argument(allowedTypes = { PDouble.class, PDecimal.class }, defaultValue = "1e1") }) public class LogFunction extends JavaMathTwoArgumentFunction { public static final String NAME = "LOG"; public LogFunction() { } public LogFunction(List<Expression> children) throws SQLException { super(children); } @Override public String getName() { return NAME; } @Override protected double compute(double firstArg, double secondArg) { return Math.log(firstArg) / Math.log(secondArg); } @Override public OrderPreserving preservesOrder() { return OrderPreserving.YES; } }
@BuiltInFunction(name = LnFunction.NAME, args = { @Argument(allowedTypes = { PDouble.class, PDecimal.class }) }) public class LnFunction extends JavaMathOneArgumentFunction { public static final String NAME = "LN"; public LnFunction() { } public LnFunction(List<Expression> children) throws SQLException { super(children); } @Override public String getName() { return NAME; } @Override protected double compute(double firstArg) { return Math.log(firstArg); } @Override public OrderPreserving preservesOrder() { return OrderPreserving.YES; } }
@BuiltInFunction(name = ExpFunction.NAME, args = { @Argument(allowedTypes = { PDouble.class, PDecimal.class }) }) public class ExpFunction extends JavaMathOneArgumentFunction { public static final String NAME = "EXP"; public ExpFunction() { } public ExpFunction(List<Expression> children) throws SQLException { super(children); } @Override public String getName() { return NAME; } @Override protected double compute(double firstArg) { return Math.exp(firstArg); } @Override public OrderPreserving preservesOrder() { return OrderPreserving.YES; } }
@FunctionParseNode.BuiltInFunction(name = ArrayPrependFunction.NAME, nodeClass=ArrayModifierParseNode.class, args = { @FunctionParseNode.Argument(allowedTypes = {PVarbinary.class}), @FunctionParseNode.Argument(allowedTypes = {PBinaryArray.class, PVarbinaryArray.class})}) public class ArrayPrependFunction extends ArrayModifierFunction { public static final String NAME = "ARRAY_PREPEND"; public ArrayPrependFunction() { } public ArrayPrependFunction(List<Expression> children) throws TypeMismatchException { super(children); } @Override protected boolean modifierFunction(ImmutableBytesWritable ptr, int len, int offset, byte[] arrayBytes, PDataType baseDataType, int arrayLength, Integer maxLength, Expression arrayExp) { return PArrayDataType.prependItemToArray(ptr, len, offset, arrayBytes, baseDataType, arrayLength, getMaxLength(), arrayExp.getSortOrder()); } @Override public String getName() { return NAME; } }
@BuiltInFunction(name = SqrtFunction.NAME, args = { @Argument(allowedTypes = { PDouble.class, PDecimal.class }) }) public class SqrtFunction extends JavaMathOneArgumentFunction { public static final String NAME = "SQRT"; public SqrtFunction() { } public SqrtFunction(List<Expression> children) throws SQLException { super(children); } @Override public String getName() { return NAME; } @Override protected double compute(double firstArg) { return Math.sqrt(firstArg); } @Override public OrderPreserving preservesOrder() { return OrderPreserving.YES; } }
@BuiltInFunction(name = CbrtFunction.NAME, args = { @Argument(allowedTypes = { PDouble.class, PDecimal.class }) }) public class CbrtFunction extends JavaMathOneArgumentFunction { public static final String NAME = "CBRT"; public CbrtFunction() { } public CbrtFunction(List<Expression> children) throws SQLException { super(children); } @Override public String getName() { return NAME; } @Override protected double compute(double firstArg) { return Math.cbrt(firstArg); } @Override public OrderPreserving preservesOrder() { return OrderPreserving.YES; } }
/** * * Function used to represent NOW() * The function returns a {@link org.apache.phoenix.schema.types.PTimestamp} * */ @BuiltInFunction(name = NowFunction.NAME, nodeClass=CurrentDateParseNode.class, args= {}, classType = FunctionClassType.ALIAS, derivedFunctions = {CurrentDateFunction.class}) public abstract class NowFunction extends ScalarFunction { public static final String NAME = "NOW"; public NowFunction() {} public NowFunction(List<Expression> children) throws SQLException { super(children); } @Override public String getName() { return NAME; } }
@BuiltInFunction(name = PowerFunction.NAME, args = { @Argument(allowedTypes = { PDouble.class, PDecimal.class }), @Argument(allowedTypes = { PDouble.class, PDecimal.class }) }) public class PowerFunction extends JavaMathTwoArgumentFunction { public static final String NAME = "POWER"; public PowerFunction() { } public PowerFunction(List<Expression> children) throws SQLException { super(children); } @Override public String getName() { return NAME; } @Override protected double compute(double firstArg, double secondArg) { return Math.pow(firstArg, secondArg); } }
@FunctionParseNode.BuiltInFunction(name = ArrayAppendFunction.NAME, nodeClass=ArrayModifierParseNode.class, args = { @FunctionParseNode.Argument(allowedTypes = {PBinaryArray.class, PVarbinaryArray.class}), @FunctionParseNode.Argument(allowedTypes = {PVarbinary.class})}) public class ArrayAppendFunction extends ArrayModifierFunction { public static final String NAME = "ARRAY_APPEND"; public ArrayAppendFunction() { } public ArrayAppendFunction(List<Expression> children) throws TypeMismatchException { super(children); } @Override protected boolean modifierFunction(ImmutableBytesWritable ptr, int len, int offset, byte[] arrayBytes, PDataType baseDataType, int arrayLength, Integer maxLength, Expression arrayExp) { return PArrayDataType.appendItemToArray(ptr, len, offset, arrayBytes, baseDataType, arrayLength, getMaxLength(), arrayExp.getSortOrder()); } @Override public String getName() { return NAME; } }
@BuiltInFunction(name=RegexpReplaceFunction.NAME, args= { @Argument(allowedTypes={PVarchar.class}), @Argument(allowedTypes={PVarchar.class}), @Argument(allowedTypes={PVarchar.class},defaultValue="null")}, classType = FunctionClassType.DERIVED ) public class ByteBasedRegexpReplaceFunction extends RegexpReplaceFunction { public ByteBasedRegexpReplaceFunction() { } public ByteBasedRegexpReplaceFunction(List<Expression> children) { super(children); } @Override protected AbstractBasePattern compilePatternSpec(String value) { return new JONIPattern(value, Option.MULTILINE); } }
@BuiltInFunction(name=RegexpSubstrFunction.NAME, args= { @Argument(allowedTypes={PVarchar.class}), @Argument(allowedTypes={PVarchar.class}), @Argument(allowedTypes={PLong.class}, defaultValue="1")}, classType = FunctionClassType.DERIVED ) public class ByteBasedRegexpSubstrFunction extends RegexpSubstrFunction { public ByteBasedRegexpSubstrFunction() { } public ByteBasedRegexpSubstrFunction(List<Expression> children) { super(children); } @Override protected AbstractBasePattern compilePatternSpec(String value) { return new JONIPattern(value, Option.MULTILINE); } }
@BuiltInFunction(name=RegexpSubstrFunction.NAME, args= { @Argument(allowedTypes={PVarchar.class}), @Argument(allowedTypes={PVarchar.class}), @Argument(allowedTypes={PLong.class}, defaultValue="1")}, classType = FunctionClassType.DERIVED ) public class StringBasedRegexpSubstrFunction extends RegexpSubstrFunction { public StringBasedRegexpSubstrFunction() { } public StringBasedRegexpSubstrFunction(List<Expression> children) { super(children); } @Override protected AbstractBasePattern compilePatternSpec(String value) { return new JavaPattern(value, Pattern.DOTALL); } }
@BuiltInFunction(name=RegexpSplitFunction.NAME, args= { @Argument(allowedTypes={PVarchar.class}), @Argument(allowedTypes={PVarchar.class})}, classType = FunctionClassType.DERIVED ) public class StringBasedRegexpSplitFunction extends RegexpSplitFunction { public StringBasedRegexpSplitFunction() { } public StringBasedRegexpSplitFunction(List<Expression> children) { super(children); } @Override protected AbstractBaseSplitter compilePatternSpec(String value) { return new GuavaSplitter(value); } }
@BuiltInFunction(name=RegexpReplaceFunction.NAME, args= { @Argument(allowedTypes={PVarchar.class}), @Argument(allowedTypes={PVarchar.class}), @Argument(allowedTypes={PVarchar.class},defaultValue="null")}, classType = FunctionClassType.DERIVED ) public class StringBasedRegexpReplaceFunction extends RegexpReplaceFunction { public StringBasedRegexpReplaceFunction() { } public StringBasedRegexpReplaceFunction(List<Expression> children) { super(children); } @Override protected AbstractBasePattern compilePatternSpec(String value) { return new JavaPattern(value, Pattern.DOTALL); } }
@BuiltInFunction(name=RegexpSplitFunction.NAME, args= { @Argument(allowedTypes={PVarchar.class}), @Argument(allowedTypes={PVarchar.class})}, classType = FunctionClassType.DERIVED ) public class ByteBasedRegexpSplitFunction extends RegexpSplitFunction { public ByteBasedRegexpSplitFunction() { } public ByteBasedRegexpSplitFunction(List<Expression> children) { super(children); } @Override protected AbstractBaseSplitter compilePatternSpec(String value) { return new JONIPattern(value, Option.MULTILINE); } }
@BuiltInFunction(name="WITH_MULTIPLE_DEFAULT_ARGS", args={ @Argument(allowedTypes={PVarchar.class}), @Argument(allowedTypes={PVarchar.class}, defaultValue = "'a'"), @Argument(allowedTypes={PVarchar.class}, defaultValue = "'b'") }) static class WithMultipleDefaultArgs extends BaseFunctionAdapter { public WithMultipleDefaultArgs(List<Expression> ignoreChildren) { super("WITH_MULTIPLE_DEFAULT_ARGS"); } } }
@BuiltInFunction(name="WITH_ONE_DEFAULT_ARG", args={ @Argument(allowedTypes={PVarchar.class}), @Argument(allowedTypes={PVarchar.class}), @Argument(allowedTypes={PVarchar.class}, defaultValue = "'a'") }) static class WithOneDefaultArg extends BaseFunctionAdapter { public WithOneDefaultArg(List<Expression> ignoreChildren) { super("WITH_ONE_DEFAULT_ARG"); } }
@BuiltInFunction(name="NO_DEFAULT_ARGS", args={ @Argument(allowedTypes={PVarchar.class}), @Argument(allowedTypes={PVarchar.class})}) static class NoDefaultArgsFunction extends BaseFunctionAdapter { public NoDefaultArgsFunction(List<Expression> ignoreChildren) { super("NO_DEFAULT_ARGS"); } }