HyukjinKwon commented on a change in pull request #32619:
URL: https://github.com/apache/spark/pull/32619#discussion_r636795325
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -770,6 +770,10 @@ class Analyzer(override val catalogManager: CatalogManager)
First(ifExpr(expr), true)
case Last(expr, _) =>
Last(ifExpr(expr), true)
+ case a: ApproximatePercentile =>
+ // ApproximatePercentile takes two literals for accuracy and
percentage which
+ // should not be wrapped by if-else.
+ a.withNewChildren(ifExpr(a.first) :: a.second :: a.third ::
Nil)
Review comment:
So, previously the percentage and accuracy was wrapped by non-foldable
if-else which caused analysis failures:
```
if ((type#7 <=> cast(b as string))) 10000 else cast(null as int)
```
--
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]