DaysBetween in Pig gives wrong result for the month of March
I'm trying to convert a Vertica request to Pig which basically defines the number of days between two dates. When I converted the code and tried to use the DaysBetween function in PIG, it gives different output only for the month of March.
Y = FOREACH X GENERATE (DaysBetween((datetime)ToDate('2015-04-01'),ToDate('2015-03-01'))); Output:- (30)
SELECT JULIAN_DAY('2015-04-01')-JULIAN_DAY('2015-03-01'); Output:- (31)
When I checked the same for other months of the year, I don't get any errors.
Y = FOREACH X GENERATE (DaysBetween((datetime)ToDate('2015-03-04'),ToDate('2015-02-04'))); Output:- (28)
SELECT JULIAN_DAY('2015-03-04')-JULIAN_DAY('2015-02-04'); Output :- 28
I cannot find the reason for the difference. Give some tips on how to solve the problem.
source to share