raminqaf commented on code in PR #28199:
URL: https://github.com/apache/flink/pull/28199#discussion_r3267475393


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/TraitCondition.java:
##########
@@ -68,4 +70,30 @@ static TraitCondition not(final TraitCondition condition) {
         return new BuiltInCondition(
                 BuiltInCondition.Kind.NOT, List.of(condition), ctx -> 
!condition.test(ctx));
     }
+
+    /**
+     * True when the named {@code MAP<STRING, STRING>} scalar argument has a 
key that, after
+     * splitting on comma and trimming each part, equals {@code key}. Returns 
true when the argument
+     * is omitted, on the assumption that an absent argument means the 
function falls back to a
+     * default that includes all keys.
+     */
+    @SuppressWarnings("rawtypes")
+    static TraitCondition mapArgIncludesKey(final String argName, final String 
key) {
+        return new BuiltInCondition(
+                BuiltInCondition.Kind.MAP_ARG_INCLUDES_KEY,
+                List.of(argName, key),
+                ctx ->
+                        ctx.getScalarArgument(argName, Map.class)
+                                .map(map -> mapKeysContain(map, key))
+                                .orElse(true));
+    }
+
+    /** True when any key in {@code map}, split on comma and trimmed, equals 
{@code expected}. */
+    private static boolean mapKeysContain(final Map<?, ?> map, final String 
expected) {

Review Comment:
   How about we do this?
   ```suggestion
       private static boolean mapKeysContain(final Map<String, String> map, 
final String expected) {
   ```
   
   and remove the cast?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to