Hello,

the design pattern here is to emit the component you want to sort by (second 
field of your value in your case) as the key in the map phase.

If you also want to keep the sorting by the original key, you need to emit a 
composite key, consisting of your original key and that part of the value. This 
technique is called the secondary sort.

Kai

Am 23.04.2013 um 07:44 schrieb Vikas Jadhav <[email protected]>:

> Hi
>  
> how to sort value in hadoop using standard sorting algorithm of hadoop ( i.e 
> sorting facility provided by hadoop)
>  
> Requirement:
>  
> 1) Values shoulde be sorted depending on some part of value
>  
> For Exam     (KEY,VALUE)
>  
>  (0,"BC,4,XY')
>  (1,"DC,1,PQ")
>  (2,"EF,0,MN")
>  
> Sorted sequence @ reduce reached should be
>  
> (2,"EF,0,MN")
> (1,"DC,1,PQ")
> (0,"BC,4,XY')
>  
> Here sorted depending on second attribute postion in value.
>  
> Thanks
>  
> 
> 
> --
> 
>   Regards,
>    Vikas

-- 
Kai Voigt
[email protected]




Reply via email to