Copilot commented on code in PR #4650:
URL: https://github.com/apache/calcite/pull/4650#discussion_r2554109898
##########
core/src/test/resources/sql/planner.iq:
##########
@@ -147,6 +147,53 @@ EnumerableCalc(expr#0..2=[{inputs}], $f0=[$t1], $f1=[$t2])
!plan
!set planner-rules original
+# Add tests for [CALCITE-6985] to verify AggregateMinMaxToLimitRule handles
empty tables correctly
+!use blank
+create table t_empty (id int);
+(0 rows modified)
+
+!update
+
+select min(id), max(id) from t_empty;
++--------+--------+
+| EXPR$0 | EXPR$1 |
++--------+--------+
+| | |
++--------+--------+
+(1 row)
+
+!ok
+EnumerableAggregate(group=[{}], EXPR$0=[MIN($0)], EXPR$1=[MAX($0)])
+ EnumerableTableScan(table=[[BLANK, T_EMPTY]])
+!plan
+
+!set planner-rules "+AGGREGATE_MIN_MAX_TO_LIMIT,
+ -EnumerableRules.ENUMERABLE_AGGREGATE_RULE,
+ +PROJECT_SUB_QUERY_TO_CORRELATE"
Review Comment:
The planner-rules format is inconsistent with the documented format (lines
28-33) and the previous example (lines 122-125). According to the format rules:
1. Line 170 should be `!set planner-rules "`
2. Line 171 should be `+AGGREGATE_MIN_MAX_TO_LIMIT,`
3. Line 172 should be `-EnumerableRules.ENUMERABLE_AGGREGATE_RULE,`
4. Line 173 should be `+PROJECT_SUB_QUERY_TO_CORRELATE"`
Each rule should be on its own line with the opening quote on the `!set
planner-rules` line.
```suggestion
!set planner-rules "
+AGGREGATE_MIN_MAX_TO_LIMIT,
-EnumerableRules.ENUMERABLE_AGGREGATE_RULE,
+PROJECT_SUB_QUERY_TO_CORRELATE"
```
--
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]