apache pig - How Do we extract only the DATE portion from datetime datatype column in Pig? -


for ex: bringing hive table column (datetime data type) value in pig , want extract on;y date portion. have tried using todate function. below error information. please me in critical situation.

the original value in column "2014-07-29t06:01:33.705-04:00", need out put "2014-07-29"

todate(eff_end_ts,'yyyy-mm-dd') delta_column; 

2016-07-28 07:07:25,298 [main] error org.apache.pig.tools.grunt.grunt - error 1045: not infer matching function org.apache.pig.builtin.todate multiple or none of them fit. please use explicit cast.

assuming column name f1 has timestamp values 2014-07-29t06:01:33.705-04:00, have use getyear(),getmonth,getday , concat required format.

b = foreach generate concat(                        concat(                        concat((chararray)getyear(f1),'-')),                        (concat((chararray)getmonth(f1),'-')),                               (chararray)getday(f1)) day; 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -