Find DISTINCT masking join fan-out

Proprietary

DISTINCT paired with a JOIN frequently compensates for row multiplication that a correct join condition or an EXISTS test would avoid, and DISTINCT alongside GROUP BY is redundant because grouping already collapses duplicate rows. A DISTINCT on a single-table query without GROUP BY is not flagged.

org.openrewrite.sql.antipattern.FindDistinctWithJoin

Optional

markSourceBoolean

Whether to mark each occurrence in source, and apply the fix where the rule remediates. Defaults to true; set to false to leave source untouched and report only to the data table, as an analysis-only pipeline requires.

mod run . --recipe=org.openrewrite.sql.antipattern.FindDistinctWithJoin

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.