Changes between Initial Version and Version 1 of Ticket #36025, comment 4
- Timestamp:
- Dec 18, 2024, 11:42:37 AM (4 weeks ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #36025, comment 4
initial v1 5 5 If that's truly the case then it means that the likely culprit is how `RangeLookup` stores its resolved right-hand-side as a `tuple(Col(...), Col(...))` which trips resolvable detection (`hasattr(expr, "resolve_expression")`) that happens when alias relabeling takes place (see `Expression.relabeled_clone`). 6 6 7 `Expression.relabeled_clone`, which is called when subqueries are involved and tables need to be re-aliases to avoid conflicts, relies on `self.get_source_expression` to ''walk'' through the expression tree and make sure all nested references to tables are re-aliases. If you look at `Lookup.get_source_expressions` though you'll notice that the right-hand-side is excluded if it's not a ''compilable'' (this should likely be a ''resolvable'' check instead). Since `RangeLookup.rhs` is a `tuple` and thus not considered a ''resolvable'' it falls on its face and i sn't considered for re-labeling.7 `Expression.relabeled_clone`, which is called when subqueries are involved and tables need to be re-aliases to avoid conflicts, relies on `self.get_source_expression` to ''walk'' through the expression tree and make sure all nested references to tables are re-aliases. If you look at `Lookup.get_source_expressions` though you'll notice that the right-hand-side is excluded if it's not a ''compilable'' (this should likely be a ''resolvable'' check instead). Since `RangeLookup.rhs` is a `tuple` and thus not considered a ''resolvable'' it falls on its face and its members are not considered for re-labeling. 8 8 9 9 We have a larger problem here where lookups that allow containers of potentially ''resolvable'' members as right-hand-side (e.g. `__range`, `__in`) that are not considered as ''resolvable'' themselves that we should address but the immediate solution for `RangeLookup` appears to be wrapping it's right-hand-side in an `ExpressionList` at resolving time.