Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
When sending granularity to TimeFormatExtractionFunction we need to add timezone to the granularity to align it with the timezone specified in calcite connection. If no timezone is specified in granularity, It is considered as UTC timezone by druid.
Note the return value in is as per granularity UTC and not IST as expected -
@Test public void testTmeWithFilterOnFloorOnTimeWithTimezoneConversion() { final String sql = "Select cast(floor(\"timestamp\" to MONTH) as timestamp) as t from " + "\"foodmart\" where floor(\"timestamp\" to MONTH) >= '1997-04-30 18:30:00 UTC' order by t" + " limit 1"; final String druidQueryPart1 = "filter\":{\"type\":\"bound\",\"dimension\":\"__time\"," + "\"lower\":\"1997-05-01T00:00:00.000Z\",\"lowerStrict\":false," + "\"ordering\":\"lexicographic\",\"extractionFn\":{\"type\":\"timeFormat\"," + "\"format\":\"yyyy-MM-dd"; final String druidQueryPart2 = "\"granularity\":\"month\",\"timeZone\":\"IST\"," + "\"locale\":\"en-US\"}},\"dimensions\":[],\"metrics\":[],\"granularity\":\"all\""; CalciteAssert.that() .enable(enabled()) .with(ImmutableMap.of("model", FOODMART.getPath())) .with(CalciteConnectionProperty.TIME_ZONE.camelName(), "IST") .query(sql) .runs() .queryContains(druidChecker(druidQueryPart1, druidQueryPart2)) .returnsOrdered("T=1997-05-01 05:30:00"); }
Attachments
Issue Links
- is related to
-
CALCITE-1947 Add time/timestamp with local time zone types to optimizer
-
- Closed
-
- relates to
-
CALCITE-2138 Add Locale.getDefault() to forbidden api list
-
- Open
-