Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-1734

cast(<string> as timestamp) should not require zero padded elements

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • Impala 2.1
    • Product Backlog
    • None

    Description

      When casting strings to timestamps, it should not be necessary to left pad values with zeros.

      From the ANSI SQL/foundation spec

      <date value> ::=
        <years value> <minus sign> <months value> <minus sign> <days value>
      
      <time value> ::=
        <hours value> <colon> <minutes value> <colon> <seconds value>
      

      Examples that do not work that should

      select version()
      +-----------------------------------------------------------------------------------------+
      | version()                                                                               |
      +-----------------------------------------------------------------------------------------+
      | impalad version 2.6.0-cdh5.8.0 RELEASE (build 5464d1750381b40a7e7163b12b09f11b891b4de3) |
      | Built on Thu, 16 Jun 2016 12:43:48 PST                                                  |
      +-----------------------------------------------------------------------------------------+
      
      select cast('2015-1-01' as timestamp) as ts;
      +------+
      | ts   |
      +------+
      | NULL |
      +------+
      
      select cast('2015-01-1' as timestamp) as ts;
      +------+
      | ts   |
      +------+
      | NULL |
      +------+
      
      select cast('2016-1-1 9:5:7' as timestamp) as ts
      +------+
      | ts   |
      +------+
      | NULL |
      +------+
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ukrzilla_impala_606d Denys Lamanov
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: