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

    https://github.com/apache/flink/pull/2094#discussion_r76040520
  
    --- Diff: 
flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInformation.java
 ---
    @@ -160,6 +161,53 @@ public boolean isSortKeyType() {
        @PublicEvolving
        public abstract TypeSerializer<T> createSerializer(ExecutionConfig 
config);
     
    +
    +   /**
    +    * Creates a {@link FieldAccessor} for the given field position, which 
can be used to get and set
    +    * the specified field on instances of this type.
    +    *
    +    * @param pos The field position (zero-based)
    +    * @param config Configuration object
    +    * @param <F> The type of the field to access
    +    * @return The created FieldAccessor
    +    */
    +   @PublicEvolving
    +   public <F> FieldAccessor<T, F> getFieldAccessor(int pos, 
ExecutionConfig config){
    +           throw new InvalidFieldReferenceException("Cannot reference 
field by position on " + this.toString()
    +                   + "Referencing a field by position is supported on 
tuples, case classes, and arrays. "
    +                   + "Additionally, you can select the 0th field of a 
primitive/basic type (e.g. int).");
    +   }
    +
    +   /**
    +    * Creates a {@link FieldAccessor} for the field that is given by a 
field expression,
    +    * which can be used to get and set the specified field on instances of 
this type.
    +    *
    +    * @see <a 
href="https://ci.apache.org/projects/flink/flink-docs-master/apis/common/index.html#define-keys-using-field-expressions";>
    +    *     Defining keys using Field Expressions</a>
    +    *
    +    * @param field The field expression
    +    * @param config Configuration object
    +    * @param <F> The type of the field to access
    +    * @return The created FieldAccessor
    +    */
    +   @PublicEvolving
    +   public <F> FieldAccessor<T, F> getFieldAccessor(String field, 
ExecutionConfig config) {
    +           throw new InvalidFieldReferenceException("Cannot reference 
field by field expression on " + this.toString()
    +                           + "Field expressions are only supported on POJO 
types, tuples, and case classes. "
    +                           + "For the requirements for a type to be 
considered a POJO, see "
    +                           + 
"https://ci.apache.org/projects/flink/flink-docs-master/apis/common/index.html#pojos";);
    +   }
    +
    +   @PublicEvolving
    +   public static class InvalidFieldReferenceException extends 
IllegalArgumentException {
    --- End diff --
    
    3b770b27c938015fedeb9e76661fd0393bdbf566


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to