[nomaster] Revert "SI-6584, Stream#distinct uses too much memory."

This reverts commit 98534b2cf67efc3930de427bfd1916fcf315fa59.

This is necessary to maintain binary compatibility with 2.10.0.