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


##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/ptf/ToChangelogFunction.java:
##########
@@ -77,6 +82,11 @@ public ToChangelogFunction(final SpecializedContext context) 
{
         final Map<String, String> opMapping =
                 callContext.getArgumentValue(2, Map.class).orElse(null);
         this.rawOpMap = buildOpMap(opMapping);
+        if (opMapping != null) {
+            // Only user-supplied mappings are validated. The default mapping 
covers all kinds by
+            // design and is harmless for insert-only or upsert inputs.
+            validateAgainstInputChangelogMode(this.rawOpMap, tableSemantics);
+        }

Review Comment:
   One more question on this, regarding the if predicate.
   ```
     // Only user-supplied mappings are validated. The default mapping covers 
all kinds by
     // design and is harmless for insert-only or upsert inputs.
   ```
   
   What if some one writes the default mapping in the op_mapping? Then the 
opMapping is not null.
   ```sql
   SELECT * FROM TO_CHANGELOG(
        input => TABLE t,
        op_mapping => MAP['INSERT', 'INSERT', 'UPDATE_BEFORE, 'UPDATE_BEFORE', 
'UPDATE_AFTER,'UPDATE_AFTER', 'DELETE', 'DELETE'])
   ```
   
   This should be theoretically also harmless because it is the default 
mapping, but will throw validation error for an append only input table. 
correct?



-- 
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