2016-09-01 3 views
0

私はfoobarに分割されているハイブテーブルhtableを持っています。私は実験のために、このテーブルの小さなサブセットを作成したいので、私は実行する事がハイブ - どのようにテーブルを選択して効率的に作成するには?

create table new_table like htable; 

insert into new_table partition (foo, bar) select * from htable 
where rand() < 0.01 and foo in (a,b) 

だろう。これは、しかし、永遠にかかり、最終的にはjava.lang.OutOfMemoryError: Java heap spaceで失敗と思うだろう。より良い方法がありますか?

答えて

2

distribute by foo, barを追加します。

insert into new_table partition (foo, bar) select * from htable 
    where rand() < 0.01 and foo in (a,b) 
    distribute by foo, bar 

これはメモリ消費量を削減します。

+0

これは実際に終了しました。ありがとう! –

関連する問題