1
當我試圖從Cassandra通過豬加載表數據集時,遇到了一些問題。目前,Cassandra版本是2.0.3。如何使用Pig從Cassandra加載CF/TABLE
下面是兩排我的數據集
>the format is "user_name","tweet","user_id':
>chaaiinzz | RT @Luis_Cortes35: @3_chaaiinzz @jonaski720 @sarajanellxo @skylalopez man I love this Spanish class | 408845338091343872
>Jessicaokelley | Absolutely love the movie "The Mortal Instruments: City Of Bones!! | 408845337965907968
的創建密鑰空間和複製數據集表嘰嘰喳喳。豬
grunt> moretestvalues= LOAD 'cql://cql3ks/twitters/' USING CqlStorage;
grunt> describe moretestvalues;
moretestvalues: {user_id: chararray,tweet: chararray,user: chararray,user_id: chararray}
grunt> dump moretestvalues;
2013-12-08 22:09:19,337 [main] ERROR org.apache.pig.tools.grunt.Grunt -ERROR 1108: Duplicate schema alias: user_id in "moretestvalues"
Details at logfile: /Users/pengyuhou/apache- cassandra/examples/pig/bin/pig_1386562141091.log
cqlsh:pxh130430> CREATE KEYSPACE cql3ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1 };
cqlsh:pxh130430> use cql3ks;
cqlsh:cql3ks> CREATE TABLE twitters (user_id varchar PRIMARY KEY, tweet varchar, user varchar);
cqlsh:cql3ks> COPY twitters (user, tweet, user_id) FROM '/tmp/nameT.csv' with delimiter = '|';
3625 rows imported in 2.142 seconds.
cqlsh:cql3ks> select count(*) from twitters;
count
-------
3620
(1 rows)
加載數據其實,我只有一個「user_ID的」列三列。我不知道爲什麼豬會在兩個「user_id」列中生成結果。
你們有什麼想法嗎?謝謝!!!
修復謝謝!!你知道如何使用「6309-fix-pig-test-compiling.txt」來修復這個bug嗎? – Patrick
你會想要從github獲得Cassandra Repo。 使用'git apply'應用補丁。 用'ant build'重新編譯Cassandra。 使用你最近編譯的Cassandra。 – RussS
謝謝。我試過另一種方式來使用Cassandra 1.2和Pig 0.7。最後,它對我有用。 – Patrick