julianhyde commented on a change in pull request #1155: [CALCITE-2991]
getMaxRowCount should return rowcount 1 for an aggrega…
URL: https://github.com/apache/calcite/pull/1155#discussion_r275012092
##########
File path: core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
##########
@@ -678,6 +678,16 @@ private void checkRowCount(String sql, double expected,
double expectedMin,
checkRowCount(sql, 1D, 1D, 1D);
}
+ @Test public void testRowCountAggregateConstantKey() {
+ final String sql = "select count(*) from emp group by 1";
+ checkRowCount(sql, 1.4D, 0D, 1D);
+ }
+
+ @Test public void testRowCountAggregateConstantKeys() {
+ final String sql = "select count(*) from emp group by 1,4";
+ checkRowCount(sql, 1.4D, 0D, 1D);
+ }
Review comment:
I agree. Calcite has a mode where "group by 1" means "group by first column"
but it is not the default, and if it were, the test would fail.
Maybe add a test "select distinct 'x', 'y' from emp", which will turn into
similar algebra.
----------------------------------------------------------------
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