Change coalesceRDDs to work with different types