Add distinct method to RichPipe and TypedPipe

Add distinct method to RichPipe and TypedPipe, as well as corresponding test