apache pig - Passing a parameter in pig -



apache pig - Passing a parameter in pig -

i running pig script grunt shell version pig 0.11.1

i have data:

dec 2 15:13:52 mailserver1 sendmail[1882]: pb2kcqu1001882: from=<info@example.com>, size=9544, class=0, nrcpts=1, msgid=<201112022012.pb2kcqu1001882@mailserver1.example.com>, proto=esmtp, daemon=mta, relay=relay1.example.com [10.0.20.6]

using loading relation:

src = load 'pg-log.txt' using pigstorage(' ') ( month: chararray, day: chararray, time: chararray, mailserver: chararray, pid: chararray, sendmailid: chararray, src: chararray, size: chararray, classnumber: chararray, nrcpts: chararray, msgid: chararray, proto: chararray, daemon: chararray, relay: chararray ); trying below step working in shell, appears taking parameter $year current year, , have used in shell initialize year:

%default year date +%y;

but not work

--t1 = foreach src generate sendmailid, format('%s-%s-%s %s', $year, month, day, time) timestamp;

so m trying hardcode year 2014 below , still error:

t1 = foreach src generate sendmailid, format('%s-%s-%s %s', 2014, month, day, time) timestamp;

error org.apache.pig.tools.grunt.grunt - error 1070: not resolve format using imports: [, org.apache.pig.builtin., org.apache.pig.impl.builtin.]

the error telling format not exists. case, there no format function in pig.

you can utilize concat this. it's bit ugly set multiple concat don't have selection in pure pig. otherwise can create udf fot this.

apache-pig

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -