Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/4144#discussion_r122829892 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/StreamTableEnvironment.scala --- @@ -437,39 +437,64 @@ abstract class StreamTableEnvironment( var rowtime: Option[(Int, String)] = None var proctime: Option[(Int, String)] = None - exprs.zipWithIndex.foreach { - case (RowtimeAttribute(reference@UnresolvedFieldReference(name)), idx) => - if (rowtime.isDefined) { + def extractRowtime(idx: Int, name: String, origName: Option[String]): Unit = { + if (rowtime.isDefined) { + 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 < fieldTypes.length && + !(TypeCheckUtils.isLong(fieldTypes(mappedIdx)) || + TypeCheckUtils.isTimePoint(fieldTypes(mappedIdx)))) { throw new TableException( - "The rowtime attribute can only be defined once in a table schema.") - } else { - // check type of field that is replaced - if (idx < fieldTypes.length && - !(TypeCheckUtils.isLong(fieldTypes(idx)) || - TypeCheckUtils.isTimePoint(fieldTypes(idx)))) { - throw new TableException( - "The rowtime attribute can only be replace a field with a valid time type, such as " + - "Timestamp or Long.") - } - rowtime = Some(idx, name) + s"The rowtime attribute can only be replace a field with a valid time type, " + --- End diff -- remove "be" -> `"The rowtime attribute can only replace a field with ..."`
--- 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. ---