calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gian Merlino (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CALCITE-1658) DateRangeRules issues
Date Fri, 24 Feb 2017 18:12:44 GMT
Gian Merlino created CALCITE-1658:
-------------------------------------

             Summary: DateRangeRules issues
                 Key: CALCITE-1658
                 URL: https://issues.apache.org/jira/browse/CALCITE-1658
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Gian Merlino
            Assignee: Julian Hyde


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.

{code}
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)
{code}

{code}
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)
  )
{code}

{code}
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)
  )
{code}

{code}
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)
  )
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message