Improve TypedSimilarity algorithm and update test.

Add one optimization to disco/dimsum algorithms: doing the filtering before the large self-join.
Update test to use TypedTsv.
I don't think we need to add another. These two paths are separate since they are grouped differently.