zabetak commented on code in PR #4591:
URL: https://github.com/apache/calcite/pull/4591#discussion_r2447731048


##########
druid/src/test/java/org/apache/calcite/test/DruidAdapterIT.java:
##########
@@ -3219,7 +3220,7 @@ private void testCountWithApproxDistinct(boolean approx, 
String sql, String expe
             + "and '1997-03-01 00:00:00 UTC' order by t limit 2";
 
     final String druidQuery = 
"{'queryType':'scan','dataSource':'foodmart','intervals':"
-        + 
"['1997-01-01T00:00:00.000Z/1997-04-01T00:00:00.000Z'],'virtualColumns':"
+        + 
"['1997-01-01T00:00:00.000Z/1997-03-01T00:00:00.001Z'],'virtualColumns':"

Review Comment:
   Initially, I had the same impression as you that the old plan/result was 
incorrect. However, I just looked the query more carefully and I realized that 
in fact the new query plan is wrong. The `WHERE` condition uses 
`floor("timestamp" to MONTH)` for the comparison so essentially a timestamp 
such as `1997-03-15T00:00:00.000` should become `1997-03-01T00:00:00.000` and 
be present in the result.
   
   Changing the query interval to `1997-03-01T00:00:00.001Z` will incorrectly 
prune out dates such as `1997-03-15T03:00:10.000`. I will have to revisit the 
Druid conversion code to see where the bug is.



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

Reply via email to