wuchong commented on a change in pull request #9349: [FLINK-13564] 
[table-planner-blink] throw exception if constant with YEAR TO MONTH resolution 
was used for group windows
URL: https://github.com/apache/flink/pull/9349#discussion_r311983643
 
 

 ##########
 File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/StreamLogicalWindowAggregateRule.scala
 ##########
 @@ -83,6 +85,14 @@ class StreamLogicalWindowAggregateRule
         throw new ValidationException("Window can only be defined over a time 
attribute column.")
     }
   }
+
+  def getOperandAsLong(call: RexCall, idx: Int): Long =
+    call.getOperands.get(idx) match {
+      case v: RexLiteral if v.getTypeName.getFamily == 
SqlTypeFamily.INTERVAL_DAY_TIME =>
+        v.getValue.asInstanceOf[JBigDecimal].longValue()
+      case _ => throw new TableException(
+        "Only constant window intervals with millisecond resolution are 
supported.")
 
 Review comment:
   The exception is not clear for users. I would suggest change it to :
   "Window aggregate only support SECOND, MINUTE, HOUR, DAY as the time unit. 
MONTH and YEAR  time unit are not supported yet." 
   
   And keep the "Only constant window descriptors are supported" exception if 
it is not a literal. 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to