tinfoil-knight commented on PR #11733:
URL: https://github.com/apache/datafusion/pull/11733#issuecomment-2259168227
For an expression like `i + 1 + 2` which gets evaluated like `(i + 1) + 2`,
we just need to re-arrange the grouping in `Simplifier`, so that the expression
changes to `i + (1 + 2)`.
In the subsequent run of the simplify, `ConstEvaluator` will resolve the
arithmetic expression which only has literals now.
```
BinaryExpr(BinaryExpr { left: BinaryExpr(BinaryExpr { left: Column(Column {
relation: None, name: "c3" }), op: Plus, right: Literal(Int32(1)) }), op: Plus,
right: Literal(Int32(2)) })
BinaryExpr(BinaryExpr { left: Column(Column { relation: None, name: "c3" }),
op: Plus, right: BinaryExpr(BinaryExpr { left: Literal(Int32(1)), op: Plus,
right: Literal(Int32(2)) }) })
BinaryExpr(BinaryExpr { left: Column(Column { relation: None, name: "c3" }),
op: Plus, right: Literal(Int32(3)) })
```
--
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]