Github user ggevay commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2211#discussion_r77988402
  
    --- Diff: 
flink-core/src/main/java/org/apache/flink/api/java/typeutils/PojoTypeInfo.java 
---
    @@ -393,6 +443,18 @@ public void addComparatorField(int fieldId, 
TypeComparator<?> comparator) {
                                keyFields.size() == fieldComparators.size(),
                                "Number of key fields and field comparators is 
not equal.");
     
    +                   Tuple2<ArrayList<Integer>, Class> custCompKey = new 
Tuple2(keyFieldIds, getTypeClass());
    +                   if (customComparators.containsKey(custCompKey)) {
    +                           return 
InstantiationUtil.instantiate(customComparators.get(custCompKey));
    +                   }
    +
    +                   if (config.isCodeGenerationEnabled()) {
    +                           return new 
PojoComparatorGenerator<T>(keyFields.toArray(new Field[keyFields.size()]),
    +                                   fieldComparators.toArray(new 
TypeComparator[fieldComparators.size()]), createSerializer
    +                                   (config), getTypeClass(), 
keyFieldIds.toArray(new Integer[keyFields.size()]), config)
    --- End diff --
    
    I think it's less verbose to use the parameterless toArray, and cast to the 
appropriate array type.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to