Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relation#sort should sort on all attributes in the header #58

Open
snusnu opened this issue Jul 14, 2014 · 4 comments · May be fixed by dkubb/axiom-do-adapter#4
Open

Relation#sort should sort on all attributes in the header #58

snusnu opened this issue Jul 14, 2014 · 4 comments · May be fixed by dkubb/axiom-do-adapter#4

Comments

@snusnu
Copy link
Collaborator

snusnu commented Jul 14, 2014

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.

@snusnu
Copy link
Collaborator Author

snusnu commented Jul 15, 2014

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.

@dkubb
Copy link
Owner

dkubb commented Jul 17, 2014

@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.

@snusnu
Copy link
Collaborator Author

snusnu commented Jul 21, 2014

@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
       #

@snusnu
Copy link
Collaborator Author

snusnu commented Jul 28, 2014

@dkubb anything i can do to further help with this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants