alamb commented on code in PR #8419:
URL: https://github.com/apache/arrow-datafusion/pull/8419#discussion_r1416281224
##########
datafusion/sql/src/expr/order_by.rs:
##########
@@ -30,6 +30,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
exprs: &[OrderByExpr],
schema: &DFSchema,
planner_context: &mut PlannerContext,
+ literal_to_column: bool,
Review Comment:
I think this is subtle enough that it would be good if we can add a comment
explaining what the parameter does
Perhaps something like
```rust
/// convert sql [OrderByExpr] to `Vec<Expr>`
///
/// if `literal_to_column` is true, treat any numeric literals (e.g.
`2`) as a 1 based index
/// into the SELECT list (e.g. `SELECT a, b FROM table ORDER BY 2`).
/// If false, interpret numeric literals as constant values
pub(crate) fn order_by_to_sort_expr(
```
##########
datafusion/sql/src/expr/function.rs:
##########
@@ -92,8 +92,12 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
.into_iter()
.map(|e| self.sql_expr_to_logical_expr(e, schema,
planner_context))
.collect::<Result<Vec<_>>>()?;
- let order_by =
- self.order_by_to_sort_expr(&window.order_by, schema,
planner_context)?;
+ let order_by = self.order_by_to_sort_expr(
+ &window.order_by,
+ schema,
+ planner_context,
+ false,
Review Comment:
```suggestion
// Numeric literals in window function ORDER BY are treated
as constants
false,
```
--
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]