how to transpose a 5x5 matrix using mapreduce -
i have tried mapper dividing matrix 2x2
, giving reducer. reducer perform transpose each 2x2
matrix. while dividing odd order matrix 2x2
leaving 1x1
matrix @ end. how write map , reduce function overcome problem. please send me solution.
assuming matrix in csv delimited columns , new line rows. can read line line in map task each line, split based on comma , token each column. need custom value object reducer(inherit writable), store line_number & value @ specific column.
the map task emit, key column number @ column value read , value custom value object defined above.
you need secondary sort/comparator sort based on custom value object's line_number filed when order can maintained when values iterated @ reducer end.
at reducer, read keys sorted based on line number, iterator each key , create csv string , write output file.
Comments
Post a Comment