AnsweredAssumed Answered

Apache pig - Inline relation/alias construction

Question asked by Lokesh on Jul 26, 2017
Latest reply on Jul 27, 2017 by deborah

Hi, i was going through PDF MapR certified Data Analyst study guide. There are about 10 sample questions of which i have doubt about question No 2.

 

Which command would create a relation, XYZ, which contains the first 100 records of relation ABC, alphabetical order by customer last name?

a) XYZ = LIMIT { ORDER ABC BY  last.name } 100;

b)PQR = ORDER ABC BY  last.name ;

XYZ = LIMIT 100;

c)XYZ = FOREACH ABC GENERATE XYZ ORDER BY last.name LIMIT 100;

d)XYZ = ORDER {LIMIT ABC 100} BY last.name;

 

Option B is marked correct. I understand why it is correct. I feel option A would also give same records. right?

 

Option C would not even compile as there is no XYZ in each ABC record.

Option D is wrong as in LIMIT ABC 100; there is no guarantee on the records returned. It may only return a subset of records from ABC that may or may not be top 100.

 

Can somebody please help me understand this?

 

Thanks,

Lokesh

Outcomes