support distance function in the order by clause