Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
Impala 2.0
-
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 | +------------------------------------------------------------------------+