Sort:  

HiveSQL is your best friend for such request