MathematicalFunction { private static FunctionResolver sign() { return FunctionDSL.define(BuiltinFunctionName.SIGN.getName(), ExprCoreType.numberTypes().stream() .map(type -> FunctionDSL.impl(FunctionDSL.nullMissingHandling( v -> new ExprIntegerValue(Math.signum(v.doubleValue()))), INTEGER, type)).collect(Collectors.toList())); }  static void register(BuiltinFunctionRepository repository);  }
@Test public void sign_null_value() { FunctionExpression sign = dsl.sign(DSL.ref(INT_TYPE_NULL_VALUE_FIELD, INTEGER)); assertEquals(INTEGER, sign.type()); assertTrue(sign.valueOf(valueEnv()).isNull()); }
@Test public void sign_missing_value() { FunctionExpression sign = dsl.sign(DSL.ref(INT_TYPE_MISSING_VALUE_FIELD, INTEGER)); assertEquals(INTEGER, sign.type()); assertTrue(sign.valueOf(valueEnv()).isMissing()); }