BinaryPredicateOperator { private static FunctionResolver notEqual() { return FunctionDSL .define(BuiltinFunctionName.NOTEQUAL.getName(), ExprCoreType.coreTypes().stream() .map(type -> FunctionDSL .impl( FunctionDSL .nullMissingHandling((v1, v2) -> ExprBooleanValue.of(!v1.equals(v2))), BOOLEAN, type, type)) .collect( Collectors.toList())); }  static void register(BuiltinFunctionRepository repository);  }
@Test public void test_null_notequal_missing() { FunctionExpression notequal = dsl.notequal(DSL.ref(BOOL_TYPE_MISSING_VALUE_FIELD, BOOLEAN), DSL.ref(BOOL_TYPE_MISSING_VALUE_FIELD, BOOLEAN)); assertEquals(BOOLEAN, notequal.type()); assertEquals(LITERAL_MISSING, notequal.valueOf(valueEnv())); notequal = dsl.notequal(DSL.ref(BOOL_TYPE_NULL_VALUE_FIELD, BOOLEAN), DSL.ref(BOOL_TYPE_NULL_VALUE_FIELD, BOOLEAN)); assertEquals(BOOLEAN, notequal.type()); assertEquals(LITERAL_NULL, notequal.valueOf(valueEnv())); notequal = dsl.notequal(DSL.ref(BOOL_TYPE_NULL_VALUE_FIELD, BOOLEAN), DSL.ref(BOOL_TYPE_MISSING_VALUE_FIELD, BOOLEAN)); assertEquals(BOOLEAN, notequal.type()); assertEquals(LITERAL_MISSING, notequal.valueOf(valueEnv())); notequal = dsl.notequal(DSL.ref(BOOL_TYPE_MISSING_VALUE_FIELD, BOOLEAN), DSL.ref(BOOL_TYPE_NULL_VALUE_FIELD, BOOLEAN)); assertEquals(BOOLEAN, notequal.type()); assertEquals(LITERAL_MISSING, notequal.valueOf(valueEnv())); notequal = dsl.notequal(DSL.literal(LITERAL_TRUE), DSL.ref(BOOL_TYPE_MISSING_VALUE_FIELD, BOOLEAN)); assertEquals(BOOLEAN, notequal.type()); assertEquals(LITERAL_MISSING, notequal.valueOf(valueEnv())); notequal = dsl.notequal(DSL.literal(LITERAL_TRUE), DSL.ref(BOOL_TYPE_NULL_VALUE_FIELD, BOOLEAN)); assertEquals(BOOLEAN, notequal.type()); assertEquals(LITERAL_NULL, notequal.valueOf(valueEnv())); notequal = dsl.notequal(DSL.ref(BOOL_TYPE_MISSING_VALUE_FIELD, BOOLEAN), DSL.literal(LITERAL_TRUE)); assertEquals(BOOLEAN, notequal.type()); assertEquals(LITERAL_MISSING, notequal.valueOf(valueEnv())); notequal = dsl.notequal(DSL.ref(BOOL_TYPE_NULL_VALUE_FIELD, BOOLEAN), DSL.literal(LITERAL_TRUE)); assertEquals(BOOLEAN, notequal.type()); assertEquals(LITERAL_NULL, notequal.valueOf(valueEnv())); }