vogievetsky opened a new issue, #13626:
URL: https://github.com/apache/druid/issues/13626

   With `kttm_simple` loaded from the `Demo 1` demo query observe this behavior:
   
   ```
   SELECT
     count(*),
     (case
       when TIME_PARSE("timestamp", NULL, 
'Asia/Kolkata')<TIME_FORMAT(CURRENT_TIMESTAMP,NULL,'Asia/Kolkata')
       then TIME_FORMAT((TIME_PARSE("timestamp", NULL, 
'Asia/Kolkata')),'yyyy-MM-dd','Asia/Kolkata')
       else 'null' end
     ) as a1
   FROM "kttm_simple"
   GROUP BY 2
   ```
   
   Returns an error of `org.apache.calcite.runtime.CalciteContextException: 
From line 4, column 21 to line 4, column 31: Expression 'kttm_simple.timestamp' 
is not being grouped`
   
   But now replace the `2` in `GROUP BY 2` with the literal expansion of the 
expression (copy paste)
   
   ```
   SELECT
     count(*),
     (case
       when TIME_PARSE("timestamp", NULL, 
'Asia/Kolkata')<TIME_FORMAT(CURRENT_TIMESTAMP,NULL,'Asia/Kolkata')
       then TIME_FORMAT((TIME_PARSE("timestamp", NULL, 
'Asia/Kolkata')),'yyyy-MM-dd','Asia/Kolkata')
       else 'null' end
     ) as a1
   FROM "kttm_simple"
   GROUP BY (case
       when TIME_PARSE("timestamp", NULL, 
'Asia/Kolkata')<TIME_FORMAT(CURRENT_TIMESTAMP,NULL,'Asia/Kolkata')
       then TIME_FORMAT((TIME_PARSE("timestamp", NULL, 
'Asia/Kolkata')),'yyyy-MM-dd','Asia/Kolkata')
       else 'null' end
     ) 
   ```
   
   The query runs:
   
   <img width="1006" alt="image" 
src="https://user-images.githubusercontent.com/177816/210453407-089a5008-6c1f-44eb-a64f-33804e03de5c.png";>
   
   Something is not right here. My understanding is that `GROUP BY 2` is just a 
shortcut.
   
   Originally reported here: 
https://apachedruidworkspace.slack.com/archives/C0303FDCZEZ/p1672226327432399


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to