cloud-fan commented on a change in pull request #29061:
URL: https://github.com/apache/spark/pull/29061#discussion_r453458611
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingNumbers.scala
##########
@@ -116,6 +116,15 @@ object NormalizeFloatingNumbers extends Rule[LogicalPlan] {
case CreateMap(children, useStringTypeWhenEmpty) =>
CreateMap(children.map(normalize), useStringTypeWhenEmpty)
+ case If(cond, trueValue, falseValue) =>
+ If(cond, normalize(trueValue), normalize(falseValue))
+
+ case CaseWhen(branches, elseVale) =>
+ CaseWhen(branches.map(br => (br._1, normalize(br._2))),
elseVale.map(normalize))
+
+ case Coalesce(children) =>
+ Coalesce(children.map(normalize))
+
case _ if expr.dataType == FloatType || expr.dataType == DoubleType =>
Review comment:
Shall we put these new cases after this case? The main goal of this
optimization is to avoid constructing a new `CreateStruct` during
normalization. If it's just a float/double type If/CashWhen/Coalesce, it's
actually an overhead to duplicate the normalization work in each child.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]