You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#32812 and #32815 made significant steps towards making our SQL tree immutable, by removing TableReferenceExpression (which was mutable) and by making TableExpressionBase.Alias immutable.
However, SelectExpression itself still has a mutable (being translated) and immutable (finalized, pushed down) states. This requires us to have separate code paths for each state in various places (e.g. SelectExpression.VisitChildren), slows down translation (since we need to duplicate/clone in various places), and is generally unsafe and not the standard way to work with expressions.
Once this is done, expression cloning can be removed. We may still choose to retain it to have unique table aliases when a fragment is cloned; however, that's mostly an esthetic SQL concern, and the direction there is to stop reusing the same fragment in multiple places in the tree in any case (for better SQL perf, #32277) - at that point the point is moot anyway.
Another reason to do this is e.g. more efficient expression comparison/hash code management: immutability would allow us to cache the hash code, and use it as a first test when doing recursive expression comparison.
Note to self: remember that TpcTablesExpression currently also has a tiny bit of immutability - remove that as part of this as well.
The text was updated successfully, but these errors were encountered:
#32812 and #32815 made significant steps towards making our SQL tree immutable, by removing TableReferenceExpression (which was mutable) and by making TableExpressionBase.Alias immutable.
However, SelectExpression itself still has a mutable (being translated) and immutable (finalized, pushed down) states. This requires us to have separate code paths for each state in various places (e.g. SelectExpression.VisitChildren), slows down translation (since we need to duplicate/clone in various places), and is generally unsafe and not the standard way to work with expressions.
Once this is done, expression cloning can be removed. We may still choose to retain it to have unique table aliases when a fragment is cloned; however, that's mostly an esthetic SQL concern, and the direction there is to stop reusing the same fragment in multiple places in the tree in any case (for better SQL perf, #32277) - at that point the point is moot anyway.
Another reason to do this is e.g. more efficient expression comparison/hash code management: immutability would allow us to cache the hash code, and use it as a first test when doing recursive expression comparison.
Note to self: remember that TpcTablesExpression currently also has a tiny bit of immutability - remove that as part of this as well.
The text was updated successfully, but these errors were encountered: