Cosmos: Reimplement ReadItem via its own expression type again
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
We currently pattern-match to identify ReadItem-compatible queries, and for those cases, make sure that a ReadItemInfo is injected into the top-level SelectExpression; this is then picked up on the shaper-generation side to produce the right shaper.
This is a hack - we should have a proper ReadItemExpression instead of the SelectExpression; but the query pipeline is currently architected in a way which makes this difficult; specifically, SelectExpression contains the `_projecitonMappings` which are referenced by ProjectionBindingExpressions in the shaper. So we'd have to introduce that mechanism into the ReadItemExpression as well, as well as into any other expression that should be the top-level in the query (e.g. top-level set operation expression in relational, where we have the same problem: #32890).
The long-term solution here is to cleanly tease apart the shaper and query side, and to prevent the shaper from needing to reference `_projectionBindings` (or similar) on SelectExpression.
/cc @ajcvickers
Contributor guide
Assessment
This issue has not been assessed yet.