Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1658

DateRangeRules issues

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.16.0
    • core, druid-adapter
    • 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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            nishantbangarwa Nishant Bangarwa
            gian Gian Merlino
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment