def get_decile_from_row_number(x, total_num_rows):
	"""
	Given (value, row number) in sorted RDD and total number of rows, return (decile, value). 
	Decile will be in integer interval [1, 10].
	Example: 
		row_number = 219, total_num_rows = 1000 ->
		219/1000 = 0.219 * 10 -> 
		int(2.19) + 1 = 3, 
		so 219 is in the 3rd decile.
	"""
	value, row_number = x
	sorted_rank = row_number / float(total_num_rows)
	decile = int(sorted_rank * 10) + 1
	return (decile, value)