How to convert time and date to Unix timestamp on Apache PIG? -


i have tuple containing (date, time, ip, id)

(23/04/2014, 19:14:30,192.168.5.28, al00000) 

and need convert date , time unix timestamp

(1398280470, 192.168.5.28, al00000) 

how can that?

ref : http://pig.apache.org/docs/r0.11.1/func.html#datetime-functions

input :

23/04/2014,19:14:30,192.168.5.28,al00000 

pig script :

a = load 'input_data.csv' using pigstorage(',')  (date:chararray,time:chararray,ip:chararray,id:chararray); b = foreach generate tounixtime(todate(concat(date, time),'dd/mm/yyyyhh:mm:ss', 'gmt')) unix_time, ip, id; 

output :

(1398280470,192.168.5.28,al00000) 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -