BinaryPredicateOperator { private static FunctionResolver like() { return FunctionDSL.define(BuiltinFunctionName.LIKE.getName(), FunctionDSL .impl(FunctionDSL.nullMissingHandling(OperatorUtils::matches), BOOLEAN, STRING, STRING)); }  static void register(BuiltinFunctionRepository repository);  }
@Test public void test_like_null() { FunctionExpression like = dsl.like(DSL.literal("str"), DSL.ref(STRING_TYPE_NULL_VALUE_FILED, STRING)); assertEquals(BOOLEAN, like.type()); assertEquals(LITERAL_NULL, like.valueOf(valueEnv())); like = dsl.like(DSL.ref(STRING_TYPE_NULL_VALUE_FILED, STRING), DSL.literal("str")); assertEquals(BOOLEAN, like.type()); assertEquals(LITERAL_NULL, like.valueOf(valueEnv())); like = dsl.like(DSL.ref(STRING_TYPE_NULL_VALUE_FILED, STRING), DSL.ref(STRING_TYPE_NULL_VALUE_FILED, STRING)); assertEquals(BOOLEAN, like.type()); assertEquals(LITERAL_NULL, like.valueOf(valueEnv())); }
@Test public void test_like_missing() { FunctionExpression like = dsl.like(DSL.literal("str"), DSL.ref(STRING_TYPE_MISSING_VALUE_FILED, STRING)); assertEquals(BOOLEAN, like.type()); assertEquals(LITERAL_MISSING, like.valueOf(valueEnv())); like = dsl.like(DSL.ref(STRING_TYPE_MISSING_VALUE_FILED, STRING), DSL.literal("str")); assertEquals(BOOLEAN, like.type()); assertEquals(LITERAL_MISSING, like.valueOf(valueEnv())); like = dsl.like(DSL.ref(STRING_TYPE_MISSING_VALUE_FILED, STRING), DSL.ref(STRING_TYPE_MISSING_VALUE_FILED, STRING)); assertEquals(BOOLEAN, like.type()); assertEquals(LITERAL_MISSING, like.valueOf(valueEnv())); }
@Test public void test_null_like_missing() { FunctionExpression like = dsl.like(DSL.ref(STRING_TYPE_NULL_VALUE_FILED, STRING), DSL.ref(STRING_TYPE_MISSING_VALUE_FILED, STRING)); assertEquals(BOOLEAN, like.type()); assertEquals(LITERAL_MISSING, like.valueOf(valueEnv())); like = dsl.like(DSL.ref(STRING_TYPE_MISSING_VALUE_FILED, STRING), DSL.ref(STRING_TYPE_NULL_VALUE_FILED, STRING)); assertEquals(BOOLEAN, like.type()); assertEquals(LITERAL_MISSING, like.valueOf(valueEnv())); }