Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Follow up to CALCITE-1601. In Druid's built in SQL module (not the Druid adapter in Calcite), some unit tests fail when DateRangeRules.FILTER_INSTANCE is enabled. These include the SQLs below. In all cases, the predicate was incorrectly simplified to "false" and no Druid queries were made.
Removing DateRangeRules from the planner causes the results to be correct.
SELECT COUNT(*) FROM druid.foo WHERE (EXTRACT(YEAR FROM __time) = 2000 AND EXTRACT(MONTH FROM __time) IN (2, 3, 5)) OR (EXTRACT(YEAR FROM __time) = 2001 AND EXTRACT(MONTH FROM __time) = 1)
SELECT COUNT(*) FROM druid.foo WHERE EXTRACT(YEAR FROM __time) IN (2000, 2001) AND ( (EXTRACT(YEAR FROM __time) = 2000 AND EXTRACT(MONTH FROM __time) IN (2, 3, 5)) OR (EXTRACT(YEAR FROM __time) = 2001 AND EXTRACT(MONTH FROM __time) = 1) )
SELECT COUNT(*) FROM druid.foo WHERE EXTRACT(YEAR FROM __time) <> 2000 AND ( (EXTRACT(YEAR FROM __time) = 2000 AND EXTRACT(MONTH FROM __time) IN (2, 3, 5)) OR (EXTRACT(YEAR FROM __time) = 2001 AND EXTRACT(MONTH FROM __time) = 1) )
SELECT COUNT(*) FROM druid.foo WHERE EXTRACT(MONTH FROM __time) IN (1, 2, 3, 5) AND ( (EXTRACT(YEAR FROM __time) = 2000 AND EXTRACT(MONTH FROM __time) IN (2, 3, 5)) OR (EXTRACT(YEAR FROM __time) = 2001 AND EXTRACT(MONTH FROM __time) = 1) )
Attachments
Issue Links
- is related to
-
CALCITE-2122 In DateRangeRules, make either TIMESTAMP or DATE literal, according to target type
- Closed