axiom
axiom copied to clipboard
Relation#sort should sort on all attributes in the header
I was under the impression that the issue title describes the expected behavior. However, when i do some_base_relation_gateway.sort.drop(1).take(1)
, neither ORDER BY
nor OFFSET/LIMIT
clauses get pushed down to the underlying (postgres) adapter. The result being that the operations are ("silently") handled in memory, while performing (potentially) slow queries.
I should maybe clarify a bit. It seems like Relation#sort
actually fulfills its promise, but it does so "in memory" only. The actual operations do not get pushed down to a (sql) backend.
@snusnu can you work out a minimal test case that demonstrates the problem? This sounds like a bug and is not at all what was intended.
@dkubb seems like the following change to axiom-do-adapter
fixes this issue:
diff --git a/lib/axiom/relation/gateway.rb b/lib/axiom/relation/gateway.rb
index 7274cc3..27d0430 100644
--- a/lib/axiom/relation/gateway.rb
+++ b/lib/axiom/relation/gateway.rb
@@ -10,7 +10,7 @@ module Axiom
# remove methods so they can be proxied
undef_method(*DECORATED_CLASS.public_instance_methods(false).map(&:to_s) - %w[materialize])
- undef_method(:project, :remove, :extend, :rename, :restrict, :sort_by, :reverse, :drop, :take)
+ undef_method(:project, :remove, :extend, :rename, :restrict, :sort, :sort_by, :reverse, :drop, :take)
# The adapter the gateway will use to fetch results
#
@dkubb anything i can do to further help with this one?