gong commented on code in PR #6165:
URL: https://github.com/apache/inlong/pull/6165#discussion_r995717389


##########
inlong-sort/sort-connectors/kafka/src/main/java/org/apache/inlong/sort/kafka/table/KafkaDynamicTableFactory.java:
##########
@@ -206,6 +216,18 @@ private static void validateSinkPartitioner(ReadableConfig 
tableOptions) {
                         throw new ValidationException(
                                 "Currently 'round-robin' partitioner only 
works "
                                         + "when option 'key.fields' is not 
specified.");
+                    } else if 
((SINK_PARTITIONER_VALUE_RAW_HASH.equals(partitioner)
+                            || 
"org.apache.inlong.sort.kafka.partitioner.RawDataHashPartitioner".equals(partitioner))
+                            && 
(!"raw".equals(tableOptions.getOptional(FORMAT).orElse(null))
+                            || 
!tableOptions.getOptional(SINK_MULTIPLE_FORMAT).isPresent()
+                            || 
!tableOptions.getOptional(SINK_MULTIPLE_PARTITION_PATTERN).isPresent()
+                            || 
tableOptions.getOptional(SINK_MULTIPLE_FORMAT).get().isEmpty()
+                            || 
tableOptions.getOptional(SINK_MULTIPLE_PARTITION_PATTERN).get().isEmpty())) {
+                        throw new ValidationException(
+                                "Currently 'raw-hash' partitioner only works "
+                                        + "when option 'format' is 'raw' and 
option 'sink.multiple.format' "
+                                        + "and 
'sink.multiple.partition-pattern' is specified.");

Review Comment:
   Maybe, add a bool variable.
   ```java
    boolean notValidRawHashPartitionerConfig = 
(SINK_PARTITIONER_VALUE_RAW_HASH.equals(partitioner)
                   || 
"org.apache.inlong.sort.kafka.partitioner.RawDataHashPartitioner".equals(partitioner))
                   && 
(!"raw".equals(tableOptions.getOptional(FORMAT).orElse(null))
                   || 
!tableOptions.getOptional(SINK_MULTIPLE_FORMAT).isPresent()
                   || 
!tableOptions.getOptional(SINK_MULTIPLE_PARTITION_PATTERN).isPresent()
                   || 
tableOptions.getOptional(SINK_MULTIPLE_FORMAT).get().isEmpty()
                   || 
tableOptions.getOptional(SINK_MULTIPLE_PARTITION_PATTERN).get().isEmpty());
   ```



-- 
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: commits-unsubscr...@inlong.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to