BinaryPredicateOperator { private static FunctionResolver gte() { return FunctionDSL .define(BuiltinFunctionName.GTE.getName(), ExprCoreType.coreTypes().stream() .map(type -> FunctionDSL .impl( FunctionDSL.nullMissingHandling( (v1, v2) -> ExprBooleanValue.of(v1.compareTo(v2) >= 0)), BOOLEAN, type, type)) .collect( Collectors.toList())); }  static void register(BuiltinFunctionRepository repository);  }
@Test public void test_gte_null() { FunctionExpression gte = dsl.gte(DSL.literal(1), DSL.ref(INT_TYPE_NULL_VALUE_FIELD, INTEGER)); assertEquals(BOOLEAN, gte.type()); assertEquals(LITERAL_NULL, gte.valueOf(valueEnv())); gte = dsl.gte(DSL.ref(INT_TYPE_NULL_VALUE_FIELD, INTEGER), DSL.literal(1)); assertEquals(BOOLEAN, gte.type()); assertEquals(LITERAL_NULL, gte.valueOf(valueEnv())); gte = dsl.gte(DSL.ref(INT_TYPE_NULL_VALUE_FIELD, INTEGER), DSL.ref(INT_TYPE_NULL_VALUE_FIELD, INTEGER)); assertEquals(BOOLEAN, gte.type()); assertEquals(LITERAL_NULL, gte.valueOf(valueEnv())); }
@Test public void test_gte_missing() { FunctionExpression gte = dsl.gte(DSL.literal(1), DSL.ref(INT_TYPE_MISSING_VALUE_FIELD, INTEGER)); assertEquals(BOOLEAN, gte.type()); assertEquals(LITERAL_MISSING, gte.valueOf(valueEnv())); gte = dsl.gte(DSL.ref(INT_TYPE_MISSING_VALUE_FIELD, INTEGER), DSL.literal(1)); assertEquals(BOOLEAN, gte.type()); assertEquals(LITERAL_MISSING, gte.valueOf(valueEnv())); gte = dsl.gte(DSL.ref(INT_TYPE_MISSING_VALUE_FIELD, INTEGER), DSL.ref(INT_TYPE_MISSING_VALUE_FIELD, INTEGER)); assertEquals(BOOLEAN, gte.type()); assertEquals(LITERAL_MISSING, gte.valueOf(valueEnv())); }
@Test public void test_null_gte_missing() { FunctionExpression gte = dsl.gte(DSL.ref(INT_TYPE_NULL_VALUE_FIELD, INTEGER), DSL.ref(INT_TYPE_MISSING_VALUE_FIELD, INTEGER)); assertEquals(BOOLEAN, gte.type()); assertEquals(LITERAL_MISSING, gte.valueOf(valueEnv())); gte = dsl.gte(DSL.ref(INT_TYPE_MISSING_VALUE_FIELD, INTEGER), DSL.ref(INT_TYPE_NULL_VALUE_FIELD, INTEGER)); assertEquals(BOOLEAN, gte.type()); assertEquals(LITERAL_MISSING, gte.valueOf(valueEnv())); }