apache pig - Using Pig's ORDER BY on Return Value of Function -
i trying sort using pig on date string column date_time_stamp
, looks cannot sort when function operates on column / field.
c = order b todate(date_time_stamp, 'dd-mmm-yy hh.mm.ss.ssssss a') asc;
here's sample data:
19-jun-15 04.45.00.000000 pm,6 20-jun-15 11.15.00.000000 am,5 19-jun-15 07.15.00.000000 am,17 21-jun-15 12.00.00.000000 am,0 20-jun-15 12.35.00.000000 pm,33
how sort on column operated on function?
as per docs : http://pig.apache.org/docs/r0.12.0/basic.html#order-by
the field_alias on order performed should present in relation/ alias.
pig supports ordering on fields simple types or tuple designator (*). cannot order on fields complex types or expressions.
in use case shared, before performing order on alias b, have project value of todate() field_alias , can perform order on field.
Comments
Post a Comment