[GitHub] [flink] godfreyhe 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

2019-08-08 Thread GitBox
godfreyhe 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_r312348542
 
 

 ##
 File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/BatchLogicalWindowAggregateRule.scala
 ##
 @@ -73,6 +76,12 @@ class BatchLogicalWindowAggregateRule
   ref.getIndex)
 }
   }
+
+  def getOperandAsLong(call: RexCall, idx: Int): Long =
+call.getOperands.get(idx) match {
+  case v: RexLiteral => v.getValue.asInstanceOf[JBigDecimal].longValue()
+  case _ => throw new TableException("Only constant window descriptors are 
supported")
 
 Review comment:
   this aligns with Flink planner, see 
[DataSetLogicalWindowAggregateRule](https://github.com/apache/flink/blob/master/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/plan/rules/dataSet/DataSetLogicalWindowAggregateRule.scala)


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


With regards,
Apache Git Services


[GitHub] [flink] godfreyhe 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

2019-08-08 Thread GitBox
godfreyhe 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_r312316102
 
 

 ##
 File path: 
flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/plan/stream/sql/agg/WindowAggregateTest.scala
 ##
 @@ -85,6 +85,18 @@ class WindowAggregateTest extends TableTestBase {
 util.verifyPlanNotExpected(sql, "TUMBLE(rowtime")
   }
 
+  @Test
+  def testWindowWrongWindowParameter(): Unit = {
+expectedException.expect(classOf[TableException])
+expectedException.expectMessage(
+  "Only constant window intervals with millisecond resolution are 
supported")
+
+val sqlQuery =
+  "SELECT COUNT(*) FROM MyTable GROUP BY TUMBLE(proctime, INTERVAL '2-10' 
YEAR TO MONTH)"
 
 Review comment:
   > Add one more test `INTERVAL '35' DAYS` which should work?
   
   yes, it's valid


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


With regards,
Apache Git Services