ラベル hive の投稿を表示しています。 すべての投稿を表示
ラベル hive の投稿を表示しています。 すべての投稿を表示

2018年7月26日木曜日

hiveにデータ投入時に、「SemanticException [Error 10062]: Need to specify partition columns because the destination table is partitioned」の対策

パーティションが切っているテーブルに、パーティションキーを指定しないと、表題のようなエラーになります。

解消方法として、以下のように、「partition」を明確に指定することです。
メタデータの先頭に移動
SET hive.exec.dynamic.partition.mode=nonstrict;
insert overwrite table tmp_xxx.test_log partition(id) select * from common.log where id = 15692 and date between '2018-06-22 00:00' and '2018-06-22 23:59';

2017年2月27日月曜日

HiveのSelect文に、ヘッダー行を出せる用法

デフォルトのselectを実行したら、ヘッダーなしの結果が出力されます。
どんなカラムなのかを知りたいときがあります。
ヘッダカラムを出力される方法は、select文を実行する前に、
以下を追加します。

set hive.cli.print.header=true;
使い方例:
hive -e "set hive.cli.print.header=true; select * from user ;"