Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-4722

Fix EqualityVisitor for interval day expressions with millis

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.11.0
    • Functions - Drill
    • None

    Description

      Issue
      The following query returns the same data for the second column as the first:

      select date_add(cast('2015-01-24 07:27:05.0' as timestamp), interval '3' HOUR), date_add(cast('2015-01-24 07:27:05.0' as timestamp), interval '5' HOUR) from (values(1));
      +------------------------+------------------------+
      |         EXPR$0         |         EXPR$1         |
      +------------------------+------------------------+
      | 2015-01-24 10:27:05.0  | 2015-01-24 10:27:05.0  |
      +------------------------+------------------------+
      

      If each column is run separately, then it produces correct result:

      select date_add(cast('2015-01-24 07:27:05.0' as timestamp), interval '3' HOUR) from (values(1));
      +------------------------+
      |         EXPR$0         |
      +------------------------+
      | 2015-01-24 10:27:05.0  |
      +------------------------+
      
      select date_add(cast('2015-01-24 07:27:05.0' as timestamp), interval '5' HOUR) from (values(1));
      +------------------------+
      |         EXPR$0         |
      +------------------------+
      | 2015-01-24 12:27:05.0  |
      +------------------------+
      

      Same problem is seen for interval of minute and second:

      select date_add(cast('2015-01-24 07:27:05.0' as timestamp), interval '50' MINUTE), date_add(cast('2015-01-24 07:27:05.0' as timestamp), interval '40' MINUTE) from (values(1));
      +------------------------+------------------------+
      |         EXPR$0         |         EXPR$1         |
      +------------------------+------------------------+
      | 2015-01-24 08:17:05.0  | 2015-01-24 08:17:05.0  |
      +------------------------+------------------------+
      
      select date_add(cast('2015-01-24 07:27:05.0' as timestamp), interval '50' second), date_add(cast('2015-01-24 07:27:05.0' as timestamp), interval '40' second) from (values(1));
      +------------------------+------------------------+
      |         EXPR$0         |         EXPR$1         |
      +------------------------+------------------------+
      | 2015-01-24 07:27:55.0  | 2015-01-24 07:27:55.0  |
      +------------------------+------------------------+
      
      select date_add(cast('2015-01-24 07:27:05.0' as timestamp), interval '3' HOUR), date_add(cast('2015-01-24 07:27:05.0' as timestamp), interval '50' MINUTE), date_add(cast('2015-01-24 07:27:05.0' as timestamp), interval '50' second) from (values(1));
      +------------------------+------------------------+------------------------+
      |         EXPR$0         |         EXPR$1         |         EXPR$2         |
      +------------------------+------------------------+------------------------+
      | 2015-01-24 10:27:05.0  | 2015-01-24 10:27:05.0  | 2015-01-24 10:27:05.0  |
      +------------------------+------------------------+------------------------+
      

      Attachments

        Activity

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

          People

            volodymyr Vova Vysotskyi
            knguyen Krystal
            Chun Chang Chun Chang
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment