Hi there,
I have a scenario where in i need to fetch records which is of 30 days old. Below is the pseudo snippet that i am trying to execute
The file “NYSE_daily_prices_H.csv” gas 2 records in the “Syscreationdate” field having 2015-07-15 and 2015-07-10
am expecting 2 records as output after executing below code when i dump Last_n_Recs
Input_file = LOAD ‘/user/hue/assign/NYSE_daily_prices_H.csv’ AS
(exchange: chararray,
symbol: chararray,
Syscreationdate: chararray,
stock_open_price: float);
–DUMP Input_file;
Last_n_Recs = FILTER Input_file BY (DaysBetween
(ToDate(‘2015-08-10′, ‘yyyy-MM-dd’, ‘UTC’),ToDate(‘2015-07-10′, ‘yyyy-MM-dd’, ‘UTC’)) <= 30;
DUMP Last_n_Recs;
The above code harcoded with date -range to test it. How ever this does not gives me a result.
I want to use the logic Currentdate – (minus) Syscreationdate < = 30 in pig script.
Can u suggest me the syntax or function to get the 30 days old records.
Date syntax format in the file yyyy-mm-dd hh:mm:ss
Thanks
Shiva