wuchong commented on a change in pull request #14633: URL: https://github.com/apache/flink/pull/14633#discussion_r563155612
########## File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/codegen/GenerateUtils.scala ########## @@ -512,18 +512,21 @@ object GenerateUtils { contextTerm: String): GeneratedExpression = { val resultType = new TimestampType(true, TimestampKind.ROWTIME, 3) val resultTypeTerm = primitiveTypeTermForType(resultType) - val Seq(resultTerm, nullTerm) = ctx.addReusableLocalVariables( + val Seq(resultTerm, nullTerm, timestamp) = ctx.addReusableLocalVariables( (resultTypeTerm, "result"), - ("boolean", "isNull")) + ("boolean", "isNull"), + ("Long", "tmp") + ) val accessCode = s""" - |$resultTerm = $TIMESTAMP_DATA.fromEpochMillis($contextTerm.timestamp()); - |if ($resultTerm == null) { - | throw new RuntimeException("Rowtime timestamp is null. Please make sure that a " + - | "proper TimestampAssigner is defined and the stream environment uses the EventTime " + - | "time characteristic."); + |$timestamp = $contextTerm.timestamp(); + |if ($timestamp == null) { Review comment: The cost of get timestamp is negligible. Therefore, I prefer the simper way. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org