Github user wuchong commented on a diff in the pull request:
https://github.com/apache/flink/pull/4532#discussion_r132834552
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/StreamTableEnvironment.scala
---
@@ -667,30 +719,62 @@ abstract class StreamTableEnvironment(
// get CRow plan
val plan: DataStream[CRow] = translateToCRow(logicalPlan, queryConfig)
+ val rowtimeFields = logicalType
+ .getFieldList.asScala
+ .filter(f => FlinkTypeFactory.isRowtimeIndicatorType(f.getType))
+
+ // convert the input type for the conversion mapper
+ // the input will be changed in the OutputRowtimeProcessFunction later
+ val convType = if (rowtimeFields.size > 1) {
+ throw new TableException(
+ s"Found more than one rowtime field:
[${rowtimeFields.map(_.getName).mkString(", ")}] in " +
+ s"the table that should be converted to a DataStream.\n" +
+ s"Please select the rowtime field that should be used as
event-time timestamp for the " +
+ s"DataStream by casting all other fields to TIMESTAMP.")
+ } else if (rowtimeFields.size == 1) {
+ val origRowType = plan.getType.asInstanceOf[CRowTypeInfo].rowType
+ val convFieldTypes = origRowType.getFieldTypes.map { t =>
+ if (FlinkTypeFactory.isRowtimeIndicatorType(t)) {
--- End diff --
.....
---
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.
---