[
https://issues.apache.org/jira/browse/FLINK-5884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15997618#comment-15997618
]
ASF GitHub Bot commented on FLINK-5884:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/3808#discussion_r114888441
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/CommonCalc.scala
---
@@ -35,21 +34,30 @@ import scala.collection.JavaConverters._
trait CommonCalc {
private[flink] def functionBody(
- generator: CodeGenerator,
- inputType: TypeInformation[Row],
- rowType: RelDataType,
- calcProgram: RexProgram,
- config: TableConfig)
+ generator: CodeGenerator,
+ inputSchema: RowSchema,
+ returnSchema: RowSchema,
+ calcProgram: RexProgram,
+ config: TableConfig)
: String = {
- val returnType = FlinkTypeFactory.toInternalRowTypeInfo(rowType)
+ val expandedExpressions = calcProgram
+ .getProjectList
+ .map(expr => calcProgram.expandLocalRef(expr))
+ // time indicator fields must not be part of the code generation
+ .filter(expr => !FlinkTypeFactory.isTimeIndicatorType(expr.getType))
+ // update indices
+ .map(expr => inputSchema.mapRexNode(expr))
+
+ val condition = if (calcProgram.getCondition != null) {
+
inputSchema.mapRexNode(calcProgram.expandLocalRef(calcProgram.getCondition))
--- End diff --
Should we validate that a filter condition does not reference a time
indicator?
This
```
.toTable(tEnv, 'a, 'b, 'c, 'd.rowtime)
.filter('d === 'd + 4.millis)
.select('a, 'b, 'c)
```
yields
```
org.apache.flink.table.api.TableException: Invalid access to a logical
field.
at
org.apache.flink.table.plan.schema.RowSchema.mapIndex(RowSchema.scala:127)
```
A better error message should explain that time indicators cannot be used
in conditions yet.
> Integrate time indicators for Table API & SQL
> ---------------------------------------------
>
> Key: FLINK-5884
> URL: https://issues.apache.org/jira/browse/FLINK-5884
> Project: Flink
> Issue Type: New Feature
> Components: Table API & SQL
> Reporter: Timo Walther
> Assignee: Timo Walther
> Priority: Blocker
> Fix For: 1.3.0
>
>
> We already discussed the need for a proper integration of time indicators
> (event-time or processing-time) for both the Table API & SQL on the ML:
> http://apache-flink-mailing-list-archive.1008284.n3.nabble.com/DISCUSS-Table-API-SQL-indicators-for-event-and-processing-time-tp15927.html
> This issue will track the progress. I will work on a design document how we
> can solve this issue.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)