Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.16.0
    • Component/s: core, druid
    • Labels:
      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

            Activity

              People

              • Assignee:
                nishantbangarwa Nishant Bangarwa
                Reporter:
                gian Gian Merlino
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: