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

TimestampAdd/Diff (SQL_TSI_) functions

    XMLWordPrintableJSON

Details

    Description

      Add TimestampAdd and TimestampDiff (SQL_TSI) functions for year, quarter, month, week, day, hour, minute, second.

      Examples
      SELECT CAST(TIMESTAMPADD(SQL_TSI_QUARTER,1,Date('2013-03-31'), SQL_DATE) AS `column_quarter`
      FROM `table_in`
      HAVING (COUNT(1) > 0)

      SELECT `table_in`.`datetime` AS `column1`,
      `table`.`Key` AS `column_Key`,
      TIMESTAMPDIFF(SQL_TSI_MINUTE,to_timestamp('2004-07-04', 'yyyy-MM-dd'),`table_in`.`datetime`) AS `sum_datediff_minute`
      FROM `calcs`

      Attachments

        Issue Links

          Activity

            People

              volodymyr Vova Vysotskyi
              aengelbrecht Andries Engelbrecht
              Vitalii Diravka Vitalii Diravka
              Votes:
              3 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: