From issues-return-146194-archive-asf-public=cust-asf.ponee.io@flink.apache.org Fri Jan 5 00:26:19 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id CB94E18077B for ; Fri, 5 Jan 2018 00:26:19 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id B9C13160C2B; Thu, 4 Jan 2018 23:26:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 096FD160C3A for ; Fri, 5 Jan 2018 00:26:18 +0100 (CET) Received: (qmail 97407 invoked by uid 500); 4 Jan 2018 23:26:18 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 97398 invoked by uid 99); 4 Jan 2018 23:26:18 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jan 2018 23:26:18 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id C8F6D180145 for ; Thu, 4 Jan 2018 23:26:17 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.03 X-Spam-Level: X-Spam-Status: No, score=-4.03 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id nwsg98M4aGyH for ; Thu, 4 Jan 2018 23:26:17 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id D59EC5FB16 for ; Thu, 4 Jan 2018 23:26:16 +0000 (UTC) Received: (qmail 97197 invoked by uid 99); 4 Jan 2018 23:26:16 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jan 2018 23:26:16 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1E5A9DFC00; Thu, 4 Jan 2018 23:26:15 +0000 (UTC) From: fhueske To: issues@flink.incubator.apache.org Reply-To: issues@flink.incubator.apache.org References: In-Reply-To: Subject: [GitHub] flink pull request #5132: [FLINK-8203] [FLINK-7681] [table] Make schema defi... Content-Type: text/plain Message-Id: <20180104232615.1E5A9DFC00@git1-us-west.apache.org> Date: Thu, 4 Jan 2018 23:26:15 +0000 (UTC) Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/5132#discussion_r159776065 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/StreamTableEnvironment.scala --- @@ -464,23 +470,29 @@ abstract class StreamTableEnvironment( throw new TableException( "The rowtime attribute can only be defined once in a table schema.") } else { - val mappedIdx = streamType match { - case pti: PojoTypeInfo[_] => - pti.getFieldIndex(origName.getOrElse(name)) - case _ => idx; - } - // check type of field that is replaced - if (mappedIdx < 0) { - throw new TableException( - s"The rowtime attribute can only replace a valid field. " + - s"${origName.getOrElse(name)} is not a field of type $streamType.") - } - else if (mappedIdx < fieldTypes.length && - !(TypeCheckUtils.isLong(fieldTypes(mappedIdx)) || - TypeCheckUtils.isTimePoint(fieldTypes(mappedIdx)))) { - throw new TableException( - s"The rowtime attribute can only replace a field with a valid time type, " + - s"such as Timestamp or Long. But was: ${fieldTypes(mappedIdx)}") + // if the fields are referenced by position, + // it is possible to replace an existing field or append the time attribute at the end + if (isReferenceByPosition) { + + val mappedIdx = streamType match { + case pti: PojoTypeInfo[_] => --- End diff -- I think this case will never be entered, because `isReferenceByPosition` will always be `false` for `PojoTypeInfo`. ---