Evaluates an ORDER BY expression against a row. This helper injects row values into the context with both: - Aliased column names (e.g., `age` from `p.age AS age`) - Original property paths (e.g., `p.age`) This dual binding is necessary because ORDER BY expressions may reference the original property path (e.g., `ORDER BY p.age`) while row values are stored under aliased names. Without this, the
(
&self,
expr: &Expression,
row_values: &std::collections::HashMap<String, Value>,
base_context: &ExecutionContext,
prop_access: Option<&PropertyAccess>,
)
| 6672 | /// stored under aliased names. Without this, the expression would resolve |
| 6673 | /// to stale values from the base context instead of the current row. |
| 6674 | fn eval_order_by_expression( |
| 6675 | &self, |
| 6676 | expr: &Expression, |
| 6677 | row_values: &std::collections::HashMap<String, Value>, |
| 6678 | base_context: &ExecutionContext, |
| 6679 | prop_access: Option<&PropertyAccess>, |
| 6680 | ) -> Result<Value, ExecutionError> { |
| 6681 | let mut ctx = base_context.clone(); |
| 6682 | |
| 6683 | for (k, v) in row_values { |
| 6684 | ctx.set_variable(k.clone(), v.clone()); |
| 6685 | |
| 6686 | // Also set the prefixed version (e.g., "p.age") when the property matches |
| 6687 | if let Some(prop) = prop_access { |
| 6688 | if prop.property == *k { |
| 6689 | let prefixed = format!("{}.{}", prop.object, prop.property); |
| 6690 | ctx.set_variable(prefixed, v.clone()); |
| 6691 | } |
| 6692 | } |
| 6693 | } |
| 6694 | |
| 6695 | self.evaluate_expression(expr, &ctx) |
| 6696 | } |
| 6697 | |
| 6698 | /// Execute in-memory sort operation |
| 6699 | fn execute_in_memory_sort( |
no test coverage detected