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

Test casting from timestamp to string with leading and trailing whitespace

    XMLWordPrintableJSON

Details

    • Test
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • Impala 3.0, Impala 2.12.0
    • Impala 2.13.0
    • Backend
    • None

    Description

      There appears to be an undocumented feature of timestamp casts where leading and trailing whitespace is ignored, at least under some circumstances. This does not seem harmful, but we don't seem to have any test coverage for this behaviour. We should add some tests to ensure that this code path is tested and that we don't accidentally change the behaviour.

       > select cast('1999-12-01 01:02:03 \t\r\n' as timestamp);
      Query: select cast('1999-12-01 01:02:03 \t\r\n' as timestamp)
      Query submitted at: 2018-03-08 17:42:35 (Coordinator: http://tarmstrong-box:25000)
      Query progress can be monitored at: http://tarmstrong-box:25000/query_plan?query_id=f545755da7e4f8bd:725fa87b00000000
      +-------------------------------------------------+
      | cast('1999-12-01 01:02:03 \t\r\n' as timestamp) |
      +-------------------------------------------------+
      | 1999-12-01 01:02:03                             |
      +-------------------------------------------------+
      [localhost:21000] > select cast(' \t1999-12-01 01:02:03 ' as timestamp);
      Query: select cast(' \t1999-12-01 01:02:03 ' as timestamp)
      Query submitted at: 2018-03-08 17:46:03 (Coordinator: http://tarmstrong-box:25000)
      Query progress can be monitored at: http://tarmstrong-box:25000/query_plan?query_id=4c4082e3364056a7:6a3e830e00000000
      +----------------------------------------------+
      | cast(' \t1999-12-01 01:02:03 ' as timestamp) |
      +----------------------------------------------+
      | 1999-12-01 01:02:03                          |
      +----------------------------------------------+
      Fetched 1 row(s) in 0.01s
      
      

      Attachments

        Activity

          People

            thundergun Vincent Tran
            tarmstrong Tim Armstrong
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: