mihaibudiu commented on code in PR #5337:
URL: https://github.com/apache/calcite/pull/5337#discussion_r4305055763
##########
core/src/test/java/org/apache/calcite/adapter/enumerable/EnumerableWindowTest.java:
##########
@@ -47,6 +52,64 @@
* Test for {@link org.apache.calcite.adapter.enumerable.EnumerableWindow}.
*/
public class EnumerableWindowTest {
+ @ParameterizedTest
+ @MethodSource("rangeNullableOrderKeyCases")
+ void testRangeNullableOrderKey(String type, String nulls, String frame,
+ String sum1, String sum2, String sum4, String sumNull) {
+ CalciteAssert.that()
+ .query("select k, sum(v) over (order by k nulls " + nulls
+ + " range between " + frame + ") as s\n"
+ + "from (values (cast(1 as " + type + "), 10), (2, 20), (4, 40),\n"
+ + " (cast(null as " + type + "), 100), (null, 200)) as t(k, v)")
+ .explainContains("EnumerableWindow")
+ .returnsUnordered("K=1; S=" + sum1,
+ "K=2; S=" + sum2,
+ "K=4; S=" + sum4,
+ "K=null; S=" + sumNull,
+ "K=null; S=" + sumNull);
+ }
+
+ private static List<Arguments> rangeNullableOrderKeyCases() {
+ final List<Arguments> cases = new ArrayList<>();
+ for (String type : new String[] {"integer", "bigint"}) {
+ for (String nulls : new String[] {"first", "last"}) {
+ // Cover PRECEDING and FOLLOWING for both the lower and upper bounds.
+ cases.add(
Review Comment:
how did you validate these expected results?
Please add a comment explaining.
--
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]