-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Describe the bug
When pushing a projection down into a MemorySourceConfig, sorting information is discarded by try_swapping_with_projection. I forget what behavior this produces: it's either less efficient planning or perhaps some kind of sanity check failure during optimization. (But it is materially harmful.)
Prior to the refactor, MemoryExec had an equivalent form of this bug.
A PR is incoming.
To Reproduce
Construct a plan with an in-memory table, a MemorySourceConfig, that has a sort order applied to it, and a projection node on top of it, and then optimize the plan. What you'll get is, something other than a properly-optimized, properly-behaving plan with a MemorySourceConfig that has a sort order. (I forget how this bug manifests itself.)
Expected behavior
The optimized plan takes advantage of the known sort order and behaves correctly despite a projection getting pushed down into the MemorySourceConfig.
Additional context
No response