If any of the columns concatenated is NULL the result will be NULL. Use 
COALESCE function around each column. You also need to CAST the numeric fields 
to STRING to able to use COALESCE. You can use CONCAT_WS to put delimiters in 
between each column.

-Nicole

From: Cdy Chen <dongyong.c...@gmail.com<mailto:dongyong.c...@gmail.com>>
Reply-To: "user@hive.apache.org<mailto:user@hive.apache.org>" 
<user@hive.apache.org<mailto:user@hive.apache.org>>
Date: Tuesday, July 17, 2012 6:26 AM
To: "user@hive.apache.org<mailto:user@hive.apache.org>" 
<user@hive.apache.org<mailto:user@hive.apache.org>>
Subject: How to CONCAT 18 columns

Hi all,

select 
CONCAT(product,test_date,test_type,context_id,fid,eval,capacity,no_of_platters,ast_rev,tester,line_id,floor_id,hstack_part_number,dcm_head,dcm_media,dcm_preamp,dcm_prime_rwrk,be_eval)
from raw_data;

It returns NULL.

Why?
And how to CONCAT so many columns?

Looking forward your suggestion!
Thank you!

Reply via email to