2015-09-20 107 views
2

我想使用豬腳本加載數據。我輸入如下Apache Pig LOAD錯誤

(1, {(1,2), (1,3), (1,4)}) 
(2, {(2,5), (2,6), (2,7)}) 

腳本

X = LOAD 'input1.txt' as (a:tuple(a1: int, b1: bag{})); 
dump X; 

錯誤:

mismatched input ';' expecting RIGHT_PAREN 

請讓我知道正確的模式加載數據。

回答

1

這是爲我工作..

((1,{(1,2),(1,3),(1,4)})) 
((2,{(2,5),(2,6),(2,7)})) 


grunt> X = LOAD '/Q3.txt' as (a:tuple(a1: int, b1: bag{})); 

Input(s): 
Successfully read 2 records (411 bytes) from: "/Q3.txt" 

Output(s): 
Successfully stored 2 records (59 bytes) in: "hdfs://localhost:9000/tmp/temp-2096988480/tmp-1540654064" 

C 

這裏是輸出:

2015-09-19 23:16:37,440 [main] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - Success! 
2015-09-19 23:16:37,443 [main] INFO org.apache.pig.data.SchemaTupleBackend - Key [pig.schematuple] was not set... will not generate code. 
2015-09-19 23:16:37,448 [main] INFO org.apache.hadoop.mapreduce.lib.input.FileInputFormat - Total input paths to process : 1 
2015-09-19 23:16:37,448 [main] INFO org.apache.pig.backend.hadoop.executionengine.util.MapRedUtil - Total input paths to process : 1 
((1,{(1,2),(1,3),(1,4)})) 
((2,{(2,5),(2,6),(2,7)}))