alamb commented on code in PR #12876:
URL: https://github.com/apache/datafusion/pull/12876#discussion_r1797064689
##########
datafusion/core/src/datasource/memory.rs:
##########
@@ -241,6 +245,31 @@ impl TableProvider for MemTable {
)
})
.collect::<Result<Vec<_>>>()?;
+
+ // If there is a projection on the source, we also need to project
orderings
Review Comment:
Instead of adjusting the ordering here, I wonder if it would be less code /
"just work" if you applied the projection to `self.sort_order` first? the
normal output properties calculation should work I think 🤔
##########
datafusion/physical-plan/src/memory.rs:
##########
@@ -207,6 +208,20 @@ impl MemoryExec {
/// [`EquivalenceProperties`], we can keep track of these equivalences
/// and treat `a ASC` and `b DESC` as the same ordering requirement.
pub fn with_sort_information(mut self, sort_information: Vec<LexOrdering>)
-> Self {
+ // All sort expressions must refer to the projected schema
+ debug_assert!({
Review Comment:
Rather than a debug assert, I think it is worth considering changing
`with_sort_information` to `try_with_sort_information` and returning a
`Result<Self>` with a real error such as which columns wasn't present, )
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]