Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/3862#discussion_r115704440
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/CodeGenerator.scala
---
@@ -1840,6 +1859,35 @@ class CodeGenerator(
}
}
+ private[flink] def generateRecordTimestamp(isEventTime: Boolean):
GeneratedExpression = {
+ val resultTerm = newName("result")
+ val nullTerm = newName("isNull")
+ val resultTypeTerm =
primitiveTypeTermForTypeInfo(SqlTimeTypeInfo.TIMESTAMP)
+ val defaultValue = primitiveDefaultValue(SqlTimeTypeInfo.TIMESTAMP)
+
+ if (isEventTime) {
+ val resultCode =
+ s"""
+ |boolean $nullTerm = $contextTerm.timestamp() == null;
--- End diff --
I think we should throw an exception if the timestamp is `null`.
The query only access the timestamp if it explicitly asks for event-time.
If the timestamp is not set, the query should fail, IMO.
As an additional check, we should add a check to the
`StreamTableEnvironment` (and the `TableSourceTable`) that verifies that
event-time is enabled in the `StreamExecutionEnvironment`.
---
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.
---