user2118349
user2118349

Reputation: 137

loading data based on conditions in APACHE PIG

Problem statement- I want to check if value of column in relation xyz is even then load first 10 fields(1-10) of a file abc and if not then load another 10(11-20).

Relation XYZ 123

Relation ABC a b c d e f g h i j k l m n o p q r s t

if 123 is even then relation PQR should have a-j other wise k-t

Could somebody help.

Upvotes: 0

Views: 112

Answers (1)

SNeumann
SNeumann

Reputation: 1177

You should write a storage function to do that.

See the implementation of CSVExcelStorage http://svn.apache.org/repos/asf/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/storage/CSVExcelStorage.java for example.

Upvotes: 1

Related Questions