minhasav commented on code in PR #30240:
URL: https://github.com/apache/flink/pull/30240#discussion_r4772515577


##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/agg/batch/WindowCodeGenerator.scala:
##########
@@ -764,7 +763,7 @@ object WindowCodeGenerator {
     new JTuple2[JLong, JLong](windowSize, slideSize)
   }
 
-  def asLong(expr: Expression): Long = extractValue(expr, classOf[JLong]).get()
+  def asLong(expr: ValueLiteralExpression): Long = 
AggregateUtil.toDuration(expr).toMillis

Review Comment:
   `extractValue` internally calls `getValueAs`, which supports conversion from 
`Long` to `Duration` but not the other way around.
   
   I changed the parameter type to reuse `AggregateUtil.toDuration`, as we do 
in streaming mode, since it expects a `ValueLiteralExpression`. But we could 
also keep the existing parameter type and use `extractValue(expr, 
classOf[Duration]).get().toMillis` directly.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to