You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "andygrove (via GitHub)" <gi...@apache.org> on 2025/01/29 14:38:47 UTC
[I] Decimal promotion is not applied consistently [datafusion-comet]
andygrove opened a new issue, #1350:
URL: https://github.com/apache/datafusion-comet/issues/1350
### Describe the bug
In `QueryPlanSerde`, we have code in `exprToProto` to ensure the decimal precision is the same for both children of a binary expression.
```scala
def exprToProto(
expr: Expression,
inputs: Seq[Attribute],
binding: Boolean = true): Option[Expr] = {
val conf = SQLConf.get
val newExpr =
DecimalPrecision.promote(conf.decimalOperationsAllowPrecisionLoss, expr, !conf.ansiEnabled)
exprToProtoInternal(newExpr, inputs, binding)
}
```
However, this calls `exprToProtoInternal` which is a recursive method. For example, when creating a binary expression:
```scala
val leftExpr = exprToProtoInternal(left, inputs, binding)
val rightExpr = exprToProtoInternal(right, inputs, binding)
```
The decimal promotion logic is not applied in this case.
Given that `exprToProto` contains a single line of code and then delegates to `exprToProtoInternal`, I propose that we simply combine these two methods.
### Steps to reproduce
_No response_
### Expected behavior
_No response_
### Additional context
_No response_
--
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: github-unsubscribe@datafusion.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Decimal promotion is not applied consistently [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on issue #1350:
URL: https://github.com/apache/datafusion-comet/issues/1350#issuecomment-2621887848
nm, I see now that `DecimalPrecision.promote` calls `expr.transformUp` and transforms the whole expression tree.
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Decimal promotion is not applied consistently [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove closed issue #1350: Decimal promotion is not applied consistently
URL: https://github.com/apache/datafusion-comet/issues/1350
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org