2014-09-10 2 views
0

하이브에서는 하나의 열로 표를 배포하고 분산 된 각 부분에 대해 파이썬을 사용하여 변환합니다. 나는이 같은 특정 열 D 번호가 기록을 조작하려는 하이브로 변환하기 전에 배포하는 방법은 무엇입니까?

: 예를 들어

from 
    (select * 
    from raw_table 
    where D=12345 
    sort by A) 
    sb 
insert overwrite table u_12345 
partition (X,Y) 
select transform(cast(A as double),B,C,D,E,F,X,Y) 
using 'hello.py' 
as A,B,C,D,E,F,X,Y 
; 

이 지금은 모두 다른 열 D 번호 위해 그것을 할 싶어, 나는 썼다 같은 코드 :

from raw_table 
insert overwrite table clean_data 
partition (X,Y) 
select transform(cast(A as double),B,C,D,E,F,X,Y) 
using 'hello.py' 
as A,B,C,D,E,F,X,Y 
distribute by D 
; 

그러나 내가 원하는 방식으로 작동하지 않습니다.

답변

0

당신은 유통 서브 쿼리를 사용할 수 있습니다 내가 테스트하지 않았습니다

을이 하나

create table clean-data as 
select 
transform (key, B,C,D,E,F,G) 
USING 'reducer_script.py' as (key, B,C,D,E,F,G_reduced) 
from (key, B,C,D,E,F,G from raw_table distribute by KEY sort by KEY, D) alias ; 
: 내 클러스터에서 작업

From (select A,B,C,D,E,F,X,Y from raw_table distribute by D) 
insert overwrite table clean_data 
partition (X,Y) 
select transform(cast(A as double),B,C,D,E,F,X,Y) 
using 'hello.py' 
as A,B,C,D,E,F,X,Y ; 

관련 문제