wangyum commented on code in PR #37697: URL: https://github.com/apache/spark/pull/37697#discussion_r960736515
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/BloomFilterAggregate.scala: ########## @@ -55,6 +55,13 @@ case class BloomFilterAggregate( Multiply(estimatedNumItemsExpression, Literal(8L))) } + def this(child: Expression, estimatedNumItems: Long) = { + this(child, Literal(estimatedNumItems), + Literal(math.min( + BloomFilter.optimalNumOfBits(estimatedNumItems, estimatedNumItems / 3000000000L.toDouble), + SQLConf.get.getConf(SQLConf.RUNTIME_BLOOM_FILTER_MAX_NUM_BITS)))) + } Review Comment: How about? ```scala this(child, Literal(estimatedNumItems), Literal(math.min( BloomFilter.optimalNumOfBits(estimatedNumItems, estimatedNumItems / (SQLConf.get.getConf(SQLConf.RUNTIME_BLOOM_FILTER_MAX_NUM_ITEMS) / BloomFilter.DEFAULT_FPP)), SQLConf.get.getConf(SQLConf.RUNTIME_BLOOM_FILTER_MAX_NUM_BITS)))) ``` The smaller `estimatedNumItems`, the smaller the `FPP`. estimatedNumItems | FPP | numBits -- | -- | -- RUNTIME_BLOOM_FILTER_MAX_NUM_ITEMS | DEFAULT_FPP | 29193763 2000000 | 0.015 | 17482271 1000000 | 0.0075 | 10183830 100000 | 7.50E-04 | 1497636 10000 | 7.50E-05 | 197688 1000 | 7.50E-06 | 24561 100 | 7.50E-07 | 2935 10 | 7.50E-08 | 341 -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org