@@ -96,7 +96,7 @@ def visit_Arel_Nodes_SelectStatementWithOutOffset(o, a, windowed = false)
9696 ( projections . map { |x | v = visit ( x ) ; v == "1" ? "1 AS [__wrp]" : v } . join ( ', ' ) ) ,
9797 ( source_with_lock_for_select_statement ( o ) ) ,
9898 ( "WHERE #{ core . wheres . map { |x | visit ( x ) } . join ' AND ' } " unless core . wheres . empty? ) ,
99- ( "GROUP BY #{ groups . map { |x | visit x } . join ', ' } " unless groups . empty? ) ,
99+ ( "GROUP BY #{ groups . map { |x | visit ( x ) } . join ', ' } " unless groups . empty? ) ,
100100 ( visit ( core . having ) if core . having ) ,
101101 ( "ORDER BY #{ orders . map { |x | visit ( x ) } . join ( ', ' ) } " if !orders . empty? && !windowed )
102102 ] . compact . join ' '
@@ -183,18 +183,18 @@ def single_distinct_select_statement?(o)
183183 ( ( p1 . respond_to? ( :distinct ) && p1 . distinct ) ||
184184 p1 . respond_to? ( :include? ) && p1 . include? ( 'DISTINCT' ) )
185185 end
186-
186+
187187 def windowed_single_distinct_select_statement? ( o )
188188 o . limit && o . offset && single_distinct_select_statement? ( o )
189189 end
190-
190+
191191 def single_distinct_select_everything_statement? ( o )
192192 single_distinct_select_statement? ( o ) && visit ( o . cores . first . projections . first ) . ends_with? ( ".*" )
193193 end
194-
194+
195195 def top_one_everything_for_through_join? ( o )
196- single_distinct_select_everything_statement? ( o ) &&
197- ( o . limit && !o . offset ) &&
196+ single_distinct_select_everything_statement? ( o ) &&
197+ ( o . limit && !o . offset ) &&
198198 join_in_select_statement? ( o )
199199 end
200200
@@ -212,9 +212,9 @@ def function_select_statement?(o)
212212
213213 def eager_limiting_select_statement? ( o )
214214 core = o . cores . first
215- single_distinct_select_statement? ( o ) &&
216- ( o . limit && !o . offset ) &&
217- core . groups . empty? &&
215+ single_distinct_select_statement? ( o ) &&
216+ ( o . limit && !o . offset ) &&
217+ core . groups . empty? &&
218218 !single_distinct_select_everything_statement? ( o )
219219 end
220220
@@ -230,7 +230,7 @@ def complex_count_sql?(o)
230230 o . limit &&
231231 !join_in_select_statement? ( o )
232232 end
233-
233+
234234 def select_primary_key_sql? ( o )
235235 core = o . cores . first
236236 return false if core . projections . size != 1
0 commit comments