chunweilei commented on a change in pull request #2103:
URL: https://github.com/apache/calcite/pull/2103#discussion_r469059693
##########
File path: core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java
##########
@@ -10287,13 +10287,41 @@ private void checkCustomColumnResolving(String table)
{
}
@Test public void testTumbleTableFunction() {
- sql("select * from table(\n"
- + "^tumble(table orders, descriptor(rowtime))^)")
- .fails("Invalid number of arguments to function 'TUMBLE'. Was
expecting 3 arguments");
sql("select rowtime, productid, orderid, 'window_start', 'window_end' from
table(\n"
+ "tumble(table orders, descriptor(rowtime), interval '2'
hour))").ok();
sql("select rowtime, productid, orderid, 'window_start', 'window_end' from
table(\n"
+ "tumble(table orders, descriptor(rowtime), interval '2' hour,
interval '1' hour))").ok();
+ // test named params.
+ sql("select rowtime, productid, orderid, 'window_start', 'window_end'\n"
+ + "from table(\n"
+ + "tumble(\n"
+ + "data => table orders,\n"
+ + "timecol => descriptor(rowtime),\n"
+ + "size => interval '2' hour))").ok();
+ sql("select rowtime, productid, orderid, 'window_start', 'window_end'\n"
+ + "from table(\n"
+ + "tumble(\n"
+ + "data => table orders,\n"
+ + "timecol => descriptor(rowtime),\n"
+ + "size => interval '2' hour,\n"
+ + "\"OFFSET\" => interval '1' hour))").ok();
+ // negative tests.
+ sql("select rowtime, productid, orderid, 'window_start', 'window_end'\n"
+ + "from table(\n"
+ + "tumble(\n"
+ + "^\"data\"^ => table orders,\n"
+ + "TIMECOL => descriptor(rowtime),\n"
+ + "SIZE => interval '2' hour))")
+ .fails("Param 'data' not found in function 'TUMBLE'; did you mean
'DATA'\\?");
Review comment:
Should we add some tests about it? (Ignore it if it already has)
----------------------------------------------------------------
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]