@Test public void log_null_missing() { FunctionExpression log = dsl.log( DSL.ref(DOUBLE_TYPE_NULL_VALUE_FIELD, DOUBLE), DSL.ref(DOUBLE_TYPE_MISSING_VALUE_FIELD, DOUBLE)); assertEquals(DOUBLE, log.type()); assertTrue(log.valueOf(valueEnv()).isMissing()); log = dsl.log( DSL.ref(DOUBLE_TYPE_MISSING_VALUE_FIELD, DOUBLE), DSL.ref(DOUBLE_TYPE_NULL_VALUE_FIELD, DOUBLE)); assertEquals(DOUBLE, log.type()); assertTrue(log.valueOf(valueEnv()).isMissing()); }
private static FunctionResolver log() { ImmutableList.Builder<SerializableFunction<FunctionName, Pair<FunctionSignature, FunctionBuilder>>> builder = new ImmutableList.Builder<>(); for (ExprType type : ExprCoreType.numberTypes()) { builder.add(FunctionDSL.impl(FunctionDSL .nullMissingHandling(v -> new ExprDoubleValue(Math.log(v.doubleValue()))), DOUBLE, type)); } for (ExprType baseType : ExprCoreType.numberTypes()) { for (ExprType numberType : ExprCoreType.numberTypes()) { builder.add(FunctionDSL.impl(FunctionDSL .nullMissingHandling((b, x) -> new ExprDoubleValue( Math.log(x.doubleValue()) / Math.log(b.doubleValue()))), DOUBLE, baseType, numberType)); } } return FunctionDSL.define(BuiltinFunctionName.LOG.getName(), builder.build()); }
MathematicalFunction { private static FunctionResolver log() { ImmutableList.Builder<SerializableFunction<FunctionName, Pair<FunctionSignature, FunctionBuilder>>> builder = new ImmutableList.Builder<>(); for (ExprType type : ExprCoreType.numberTypes()) { builder.add(FunctionDSL.impl(FunctionDSL .nullMissingHandling(v -> new ExprDoubleValue(Math.log(v.doubleValue()))), DOUBLE, type)); } for (ExprType baseType : ExprCoreType.numberTypes()) { for (ExprType numberType : ExprCoreType.numberTypes()) { builder.add(FunctionDSL.impl(FunctionDSL .nullMissingHandling((b, x) -> new ExprDoubleValue( Math.log(x.doubleValue()) / Math.log(b.doubleValue()))), DOUBLE, baseType, numberType)); } } return FunctionDSL.define(BuiltinFunctionName.LOG.getName(), builder.build()); } }
MathematicalFunction { private static FunctionResolver log() { ImmutableList.Builder<SerializableFunction<FunctionName, Pair<FunctionSignature, FunctionBuilder>>> builder = new ImmutableList.Builder<>(); for (ExprType type : ExprCoreType.numberTypes()) { builder.add(FunctionDSL.impl(FunctionDSL .nullMissingHandling(v -> new ExprDoubleValue(Math.log(v.doubleValue()))), DOUBLE, type)); } for (ExprType baseType : ExprCoreType.numberTypes()) { for (ExprType numberType : ExprCoreType.numberTypes()) { builder.add(FunctionDSL.impl(FunctionDSL .nullMissingHandling((b, x) -> new ExprDoubleValue( Math.log(x.doubleValue()) / Math.log(b.doubleValue()))), DOUBLE, baseType, numberType)); } } return FunctionDSL.define(BuiltinFunctionName.LOG.getName(), builder.build()); }  }
MathematicalFunction { private static FunctionResolver log() { ImmutableList.Builder<SerializableFunction<FunctionName, Pair<FunctionSignature, FunctionBuilder>>> builder = new ImmutableList.Builder<>(); for (ExprType type : ExprCoreType.numberTypes()) { builder.add(FunctionDSL.impl(FunctionDSL .nullMissingHandling(v -> new ExprDoubleValue(Math.log(v.doubleValue()))), DOUBLE, type)); } for (ExprType baseType : ExprCoreType.numberTypes()) { for (ExprType numberType : ExprCoreType.numberTypes()) { builder.add(FunctionDSL.impl(FunctionDSL .nullMissingHandling((b, x) -> new ExprDoubleValue( Math.log(x.doubleValue()) / Math.log(b.doubleValue()))), DOUBLE, baseType, numberType)); } } return FunctionDSL.define(BuiltinFunctionName.LOG.getName(), builder.build()); }  static void register(BuiltinFunctionRepository repository); }
MathematicalFunction { private static FunctionResolver log() { ImmutableList.Builder<SerializableFunction<FunctionName, Pair<FunctionSignature, FunctionBuilder>>> builder = new ImmutableList.Builder<>(); for (ExprType type : ExprCoreType.numberTypes()) { builder.add(FunctionDSL.impl(FunctionDSL .nullMissingHandling(v -> new ExprDoubleValue(Math.log(v.doubleValue()))), DOUBLE, type)); } for (ExprType baseType : ExprCoreType.numberTypes()) { for (ExprType numberType : ExprCoreType.numberTypes()) { builder.add(FunctionDSL.impl(FunctionDSL .nullMissingHandling((b, x) -> new ExprDoubleValue( Math.log(x.doubleValue()) / Math.log(b.doubleValue()))), DOUBLE, baseType, numberType)); } } return FunctionDSL.define(BuiltinFunctionName.LOG.getName(), builder.build()); }  static void register(BuiltinFunctionRepository repository);  }