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

    https://github.com/apache/flink/pull/5132#discussion_r159880719
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/StreamTableEnvironment.scala
 ---
    @@ -492,11 +509,16 @@ abstract class StreamTableEnvironment(
               throw new TableException(
                 "The proctime attribute can only be defined once in a table 
schema.")
           } else {
    -        // check that proctime is only appended
    -        if (idx < fieldTypes.length) {
    -          throw new TableException(
    -            "The proctime attribute can only be appended to the table 
schema and not replace " +
    -              "an existing field. Please move it to the end of the 
schema.")
    +        // if the fields are referenced by position,
    +        // it is only possible to append the time attribute at the end
    +        if (isRefByPos) {
    +
    +          // check that proctime is only appended
    +          if (idx < fieldTypes.length) {
    +            throw new TableException(
    +              "The proctime attribute can only be appended to the table 
schema and not replace " +
    +                "an existing field. Please move it to the end of the 
schema.")
    +          }
             }
             proctime = Some(idx, name)
    --- End diff --
    
    should we also check that the name of the proctime attribute is not in the 
fields of the input type?


---

Reply via email to