Spark で Hive にパーティション分割されたテーブルを作成し、Hive の他のテーブルで利用可能なデータをロードしようとしています。データのロード中に次のエラーが発生します。
エラー: org.apache.spark.sql.AnalysisException: org.apache.hadoop.hive.ql.metadata.Table.ValidationFailureSemanticException: パーティション仕様 {cardsuit=, cardcolor=, cardSuit=SPA, cardColor=BLA} に非パーティション列が含まれています;
以下は、タスクを実行するために使用されるコマンドです:-
create table if not exists hive_tutorial.hive_table(color string, suit string,value string) comment 'first hive table' row format delimited fields terminated by '|' stored as TEXTFILE;
LOAD DATA LOCAL INPATH 'file:///E:/Kapil/software-study/Big_Data_NoSql/hive/deckofcards.txt' OVERWRITE INTO TABLE hive_table; --data is correctly populated(52 rows)
SET hive.exec.dynamic.partition = true;
SET hive.exec.dynamic.partition.mode = nonstrict;
create table if not exists hive_tutorial.hive_table_partitioned(color string, suit string,value int) comment 'first hive table' partitioned by (cardSuit string,cardColor string) row format delimited fields terminated by '|' stored as TEXTFILE;
INSERT INTO TABLE hive_table_partitioned PARTITION (cardSuit,cardColor) select color,suit,value,substr(suit, 1, 3) as cardSuit,substr(color, 1, 3) as cardColor from hive_table;
--alternatively i tried
INSERT OVERWRITE TABLE hive_table_partitioned PARTITION (cardSuit,cardColor) select color,suit,value,substr(suit, 1, 3) as cardSuit,substr(color, 1, 3) as cardColor from hive_table;
データのサンプル:-
黒|スペード|2
黒|スペード|3
黒|スペード|4
黒|スペード|5
黒|スペード|6
黒|スペード|7
黒|スペード|8
黒|スペード|9
Spark 2.2.0 と Java バージョン 1.8.0_31 を使用しています。
同様のスレッドで提供された回答を確認して試しましたが、問題を解決できませんでした:- SemanticException パーティション仕様 {col=null} に非パーティション列が含まれています
ここで何か不足していますか?