Opened 13 years ago
Closed 13 years ago
#18014 closed Cleanup/optimization (fixed)
Remove rev_join_map from sql/query.py
Reported by: | Anssi Kääriäinen | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The sql.query.QuerySet.rev_join_map is used currently in two places of the query.py:
- In query.combine(). The information used there is available directly from alias_map
- In relabel_aliases as a fast path to join_map. However, one can just iterate through the join_map and relabel the aliases directly.
It is hard to see if the usage in 1. is actually currently correct or not: when combining queries the joins are re-added using _table_ name for the left hand side of the join (the thing we are joining into). I am pretty sure the correct way would be to do that using the existing lhs _alias_ so that the joins are added to the same previous join as in the original query.
While the cleanup doesn't promise much advancement, it would give a (really) small speedup to query cloning. Just getting rid of one variable is reason enough for removal I guess.
Attachments (1)
Change History (5)
comment:1 by , 13 years ago
by , 13 years ago
Attachment: | 18014.diff added |
---|
comment:2 by , 13 years ago
Has patch: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
The attached patch does the mentioned removal. I am actually pretty sure the rev_join_map usage in query.combine is broken: the intention is to use the left hand side table's alias, but rev_join_map has the table instead of the alias. All tests passed on SQLite3.