• R
    Suppress `DISTINCT` clause outside aggregate function · d38e5d27
    Ryuta Kamizono 提交于
    `DISTINCT` clause is applied inside aggregate function by
    `operation_over_aggregate_column` if needed. Unneeded outside aggregate
    function.
    
    ```ruby
      # Before
      author.unique_categorized_posts.count
      # => SELECT DISTINCT COUNT(DISTINCT "posts"."id") FROM "posts" INNER JOIN "categorizations" ON "posts"."id" = "categorizations"."post_id" WHERE "categorizations"."author_id" = ?  [["author_id", 2]]
    
      # After
      author.unique_categorized_posts.count
      # => SELECT COUNT(DISTINCT "posts"."id") FROM "posts" INNER JOIN "categorizations" ON "posts"."id" = "categorizations"."post_id" WHERE "categorizations"."author_id" = ?  [["author_id", 2]]
    ```
    
    Closes #27615
    d38e5d27
calculations.rb 13.5 KB