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

impala-server crashes with cast on a empty regexp_replace result

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • Impala 2.0
    • Impala 2.2
    • None

    Description

      On version CDH-5.2, Impala 2.0,

      I'm trying to replace french decimal values like "12,54" (string) to 12.54 (decimal(15,2)) from big CSV files loaded into a table.

      All impala-server died during the insert or create as select statement.
      I've isolated a bug when I cast some '' (empty string) into decimal after a call to regexp_replace UDF.

      To reproduce the bug:

      #### OK
      Query: select cast('' as decimal(15,2))
      +---------------------------+
      | cast('' as decimal(15,2)) |
      +---------------------------+
      | 0.00                      |
      +---------------------------+
      
      #### CRASH
      Query: select cast(regexp_replace('','a','b') as decimal(15,2))
      Error communicating with impalad: TSocket read 0 bytes
      
      #### WORKAROUND (replace one of the '' by your field)
      #### like: select cast(if( FIELD = '', NULL, regexp_replace(FIELD, ',', '.')) as decimal(15,2));
      Query: select cast(if('' = '', NULL, regexp_replace('', ',', '.')) as decimal(15,2))
      +------------------------------------------------------------------------+
      | cast(if('' = '', null, regexp_replace('', ',', '.')) as decimal(15,2)) |
      +------------------------------------------------------------------------+
      | NULL                                                                   |
      +------------------------------------------------------------------------+
      

      Attachments

        Activity

          People

            victor.bittorf_impala_fcb6 Victor Bittorf
            gpolaert_impala_e5d3 gpolaert
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: