Implementing three way sort merge join