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

    https://github.com/apache/flink/pull/3020#discussion_r93566058
  
    --- Diff: 
flink-core/src/main/java/org/apache/flink/api/java/typeutils/RowTypeInfo.java 
---
    @@ -54,6 +76,152 @@ public RowTypeInfo(TypeInformation<?>... types) {
                }
        }
     
    +   public RowTypeInfo(List<TypeInformation<?>> types, List<String> 
fieldNames) {
    +           super(Row.class, types == null ? null : types.toArray(new 
TypeInformation[types.size()]));
    +           checkNotNull(fieldNames, "FieldNames should not be null.");
    +           checkArgument(
    +                   types.size() == fieldNames.size(),
    +                   "Number of field types and names is different.");
    +           checkArgument(
    +                   types.size() == new HashSet<>(fieldNames).size(),
    +                   "Field names are not unique.");
    +
    +           this.fieldNames = new String[fieldNames.size()];
    +
    +           for (int i = 0; i < fieldNames.size(); i++) {
    +                   this.fieldNames[i] = fieldNames.get(i);
    +           }
    +   }
    +
    +   @Override
    +   public void getFlatFields(String fieldExpression, int offset, 
List<FlatFieldDescriptor> result) {
    --- End diff --
    
    It is almost ported from `CaseClassTypeInfo.getFlatFields()` except the 
field index. The `CaseClassTypeInfo` is 1-based, but `RowTypeInfo` is 0-based.


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