JiajunBernoulli commented on code in PR #3641:
URL: https://github.com/apache/calcite/pull/3641#discussion_r1468774938
##########
core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java:
##########
@@ -6562,6 +6562,67 @@ private HepProgram getTransitiveProgram() {
.check();
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-6214">[CALCITE-6214]
+ * Remove `DISTINCT` in `COUNT` if field is unique</a>. */
+ @Test void testAggregateDistinctRemove1() {
+ final String sql = ""
+ + "select count(distinct x) cnt\n"
+ + "from(\n"
+ + " select distinct sal x from emp\n"
+ + ") t ";
+ sql(sql)
+ .withRule(CoreRules.AGGREGATE_REMOVE_DISTINCT)
+ .check();
+ }
+
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-6214">[CALCITE-6214]
+ * Remove `DISTINCT` in `COUNT` if field is unique</a>. */
+ @Test void testAggregateDistinctRemove2() {
+ final String sql = ""
Review Comment:
Added it.
--
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]