Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-22558

DATE_TRUNC* does not work when specifying 'week' as the part

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • feature-backlog
    • 4.6.0, 5.0.0
    • query
    • None
    • Untriaged
    • No

    Description

      It looks like DATE_TRUNC* does not work at all for the part 'week'.

      SELECT DATE_TRUNC_MILLIS(1463284740000, 'day') as day,
      DATE_TRUNC_MILLIS(1463284740000, 'month') as month,
      DATE_TRUNC_MILLIS(1463284740000, 'week') as week,
      DATE_TRUNC_MILLIS(1463284740000, 'year') as year
       
      {
          "requestID": "d98651d3-b011-4a4e-992a-25c8ff9450ed",
          "clientContextID": "cdb5de72-9855-4e21-bb30-b32b20a942a4",
          "signature": {
              "day": "number",
              "month": "number",
              "week": "number",
              "year": "number"
          },
          "results": [
              {
                  "day": 1463270400000,
                  "month": 1462147200000,
                  "week": null,
                  "year": 1451696400000
              }
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "1.253668ms",
              "executionTime": "1.222896ms",
              "resultCount": 1,
              "resultSize": 141
          }
      }
      

      No matter what value I specify for the input date, it always returns null.

      Similarly for DATE_TRUNC_STR():

      SELECT DATE_TRUNC_STR('2016-05-18T03:59:00Z', 'week')
      {
          "requestID": "b71ca571-13fb-49b0-a531-1d093fdb9241",
          "clientContextID": "0b7f987a-2b46-4d48-9f94-d55d452c1535",
          "signature": {
              "$1": "string"
          },
          "results": [
              {
                  "$1": null
              }
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "631.406µs",
              "executionTime": "595.632µs",
              "resultCount": 1,
              "resultSize": 34
          }
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              isha Isha Kandaswamy (Inactive)
              matt.carabine Matt Carabine (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty