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

cast empty string to decimal should be consistent with other numeric types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Works for Me
    • Impala 2.0
    • Impala 2.3.0
    • None

    Description

      From the user list:

      [testnode01:21000] > select cast('' as DECIMAL(20,7));
      Query: select cast('' as DECIMAL(20,7))
      +---------------------------+
      | cast('' as decimal(20,7)) |
      +---------------------------+
      | 0.0000000                 |
      +---------------------------+
      Fetched 1 row(s) in 0.04s
      
      
      
      
      [testnode01:21000] > select cast('' as DOUBLE);
      Query: select cast('' as DOUBLE)
      +--------------------+
      | cast('' as double) |
      +--------------------+
      | NULL               |
      +--------------------+
      Fetched 1 row(s) in 0.02s
      

      Users that expect NULL can use the following workaround:

      SELECT IF(field = '',null,CAST(field as DECIMAL(20,7)));
      

      Attachments

        Issue Links

          Activity

            People

              cchanning Chris Channing
              mjacobs Matthew Jacobs
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: