2014-06-11 2 views
1

하이브 직렬화 및 deserialization 쿼리를 사용하여 HDFS에서 하이브리드 데이터웨어 하우스로 데이터를로드하려고하지만 테이블 결과를 검색 할 때 Null 결과가 나오려고합니다.hdfs에서 하이브 결과로 데이터로드

아무도 나를 도와 줄 수 있습니까?

hive>create table stations(usaf string, wban string, name string) 
    >row format serde 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' 
    >with SERDEPROPERTIES(
    >"input.regex" ="(\\d{6}) (\\d{5}) (.{29}) .*" 
    >); 

hive> load data inpath '/user/cloudera/input-new/ncdc/metadata/stations-fixed-width.txt' 
    >into table stations; 

테이블에서

hive>select * from stations limit 4; 

결과를 검색하는 동안 :

NULL NULL NULL 
    NULL NULL NULL 
    NULL NULL NULL 

샘플 데이터는 다음과 같이이 :

010014 99999 SOERSTOKKEN     NO NO ENSO +59783 +005350 +00500 

답변

1

체크 통해 UR regex - 그것은 단지 맞습니다.

create table stations(usaf string, wban string, name string) 
row format serde 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' 
with SERDEPROPERTIES(
"input.regex" ="(\\d{6}) (\\d{5}) (.{29}) .*", 
"output.format.string" = "%1$s %2$s %3$s" 
) 
; 

Plz은 당신의 재생에 대한 enter image description here

+0

덕분에, 난 그냥 쿼리를 업데이트하려고 실행 추적 이미지를 확인하지만 변화는 관찰되지 : 그냥 다음과 같이 SERDEPROPERTIESoutput.format.string 추가 .. null 일련의 얻은 .. – adarshaU

+0

실행 추적 이미지를 추가했습니다. plz 수표와 같은 경우 유용합니다. –