wombatu-kun commented on code in PR #20536:
URL: https://github.com/apache/hudi/pull/20536#discussion_r4490379611
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/dataskipping/Verdict.scala:
##########
@@ -60,6 +60,10 @@ object Verdict {
}
}
+ // A balanced OR, log2(n) deep. A left-deep `reduce(Or)` is one level per IN
value, and Spark's
+ // analysis and codegen recurse over it: a few thousand values overflow the
stack
+ private def anyOf(verdicts: Seq[Expression]): Expression =
buildBalancedPredicate(verdicts, Or)
Review Comment:
On Scala 2.13 `values.toSeq` turns the `InSet` values into a `List`, and
`buildBalancedPredicate` calls `size` and `apply(i)` on its input for every
pair, so building the OR is quadratic in the IN-list size there. Nit, not a
blocker: `buildBalancedPredicate(verdicts.toIndexedSeq, Or)` keeps it linear on
both Scala versions.
--
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]