ihuzenko commented on a change in pull request #2130:
URL: https://github.com/apache/calcite/pull/2130#discussion_r483549417



##########
File path: core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java
##########
@@ -11685,6 +11685,19 @@ private void checkCustomColumnResolving(String table) {
             + "MYFUN\\(<NUMERIC>, <NUMERIC>\\).*");
   }
 
+  @Test void testPositionalAggregateWithExpandedCurrentDateFunction() {
+    SqlConformance defaultPlusOrdinalGroupBy =
+        new SqlDelegatingConformance(SqlConformanceEnum.DEFAULT) {
+          @Override public boolean isGroupByOrdinal() {
+            return true;
+          }
+        };
+    sql("SELECT HIREDATE >= CURRENT_DATE, COUNT(*) "
+        + "FROM EMP GROUP BY 1")

Review comment:
       Positional aggregate points to the first expression in select. 
Validation tries to match 2 expression trees : 
   1. The first item from select which is already expanded at the moment and 
contains current_date as an instance of SqlBasicCall 
   2. An item from the group by where prior to my fix current_date was 
presented as an instance of the SqlIdentifier.
   
   Due to this instance mismatch validation goes further and tells that 
`Expression 'EMP.HIREDATE' is not being grouped`, although grouping was 
performed by the whole expression `HIREDATE >= CURRENT_DATE`. 
   




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to