diff options
author | Maxime Lapointe <hunter_spawn@hotmail.com> | 2016-08-10 17:27:32 -0400 |
---|---|---|
committer | Maxime Lapointe <hunter_spawn@hotmail.com> | 2016-08-16 09:45:23 -0400 |
commit | 0aae7806c10e3e3cce671c23dac6a8958ba89629 (patch) | |
tree | 6e506c2322d6dc3edb63542eaf0fe9e9a1d4481a /tasks | |
parent | 82ec6b36065e91fe0ec5a87f9419840618ce2c5d (diff) | |
download | rails-0aae7806c10e3e3cce671c23dac6a8958ba89629.tar.gz rails-0aae7806c10e3e3cce671c23dac6a8958ba89629.tar.bz2 rails-0aae7806c10e3e3cce671c23dac6a8958ba89629.zip |
Fix count which would sometimes force a DISTINCT
The current behaviour of checking if there is a LEFT OUTER JOIN arel
node to detect if we are doing eager_loading is wrong. This problem
wasn't frequent before as only some pretty specific cases would add
a LEFT OUTER JOIN arel node. However, the recent new feature
left_outer_joins also add this node and made this problem happen
frequently.
Since in the perform_calculation function, we don't have access to
eager_loading information, I had to extract the logic for the distinct
out to the calculate method.
As I was in the file for left_outer_join tests, I fixed a few that had
bugs and I replaced some that were really weak with something that
will catch more issues.
In relation tests, the first test I changed would have failed if it
had validated the hash returned by count instead of just checking how
many pairs were in it. This is because this merge of join currently
transforms the join node into an outer join node, which then made
count do a distinct. So before this change, the return was
{1=>1, 4=>1, 5=>1}.
Diffstat (limited to 'tasks')
0 files changed, 0 insertions, 0 deletions