Question 1
You need to place the results of a PigLatin script into an HDFS output directory.
What is the correct syntax in Apache Pig?
update hdfs set D as ‘./output’;
hdfsstore D into ‘./output’;
Correct answer: B
Explanation:
Use the STORE operator to run (execute) Pig Latin statements and save (persist) results to the file system. Use STORE for production scripts and batch mode processing. Syntax: STORE alias INTO 'directory' [USING function];Example: In this example data is stored using PigStorage and the asterisk character (*) as the field delimiter.A = LOAD 'data' AS (a1:int,a2:int,a3:int);DUMP A; (1,2,3) (4,2,1) (8,3,4) (4,3,3) (7,2,5) (8,4,3) STORE A INTO 'myoutput' USING PigStorage ('*'); CAT myoutput; 1*2*3 4*2*1 8*3*4 4*3*3 7*2*5 8*4*3 References: https://pig.apache.org/docs/r0.13.0/basic.html#store
Use the STORE operator to run (execute) Pig Latin statements and save (persist) results to the file system. Use STORE for production scripts and batch mode processing.
Syntax: STORE alias INTO 'directory' [USING function];
Example: In this example data is stored using PigStorage and the asterisk character (*) as the field delimiter.
A = LOAD 'data' AS (a1:int,a2:int,a3:int);
DUMP A;
(1,2,3)
(4,2,1)
(8,3,4)
(4,3,3)
(7,2,5)
(8,4,3)
STORE A INTO 'myoutput' USING PigStorage ('*');
CAT myoutput;
1*2*3
4*2*1
8*3*4
4*3*3
7*2*5
8*4*3
References: https://pig.apache.org/docs/r0.13.0/basic.html#store