apache pig - Pig: Max Value per Bag of Tuples -


so have data following:

grunt> describe aliveevents_patient_id; aliveevents_patient_id: {group: int,aliveevents: {(events::patientid: int,events::eventid: chararray,events::etimestamp: datetime,events::value: float,mortality::patientid: int,mortality::mtimestamp: datetime,mortality::label: int)}} 

how able biggest value per group of etimestamp?

essentially i'd following:

patient_id, etimestamp 1, 10 1, 20 2, 30 

outputs

patient_id, etimestamp 1, 20 2, 30 

according question :

let aliveevents_patient_id contain 2 field {patient_id,etimestamp}

then script :

a = group aliveevents_patient_id patient_id; dump a; (1,{(1,10),(1,20)}) (2,{(2,30)})  b = foreach generate group,max(aliveevents_patient_id.etimestamp); dump b;  (1,20) (2,30) 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -