mingmwang commented on issue #4372:
URL:
https://github.com/apache/arrow-datafusion/issues/4372#issuecomment-1331871103
@isidentical
Presto/Trino, looks like it is default to 0.9
````
booleanProperty(
DEFAULT_FILTER_FACTOR_ENABLED,
"use a default filter factor for unknown filters in a filter node",
optimizerConfig.isDefaultFilterFactorEnabled(),
false),
````
https://github.com/trinodb/trino/blob/0f71007ecb480384a9c443ba883f4bc4d896df83/core/trino-main/src/main/java/io/trino/cost/FilterStatsCalculator.java#L90-L93
SparkSQL, looks like it is default to 1.0
````
def calculateFilterSelectivity(condition: Expression, update: Boolean =
true): Option[Double] = {
condition match {
case And(cond1, cond2) =>
val percent1 = calculateFilterSelectivity(cond1,
update).getOrElse(1.0)
val percent2 = calculateFilterSelectivity(cond2,
update).getOrElse(1.0)
Some(percent1 * percent2)
case Or(cond1, cond2) =>
val percent1 = calculateFilterSelectivity(cond1, update =
false).getOrElse(1.0)
val percent2 = calculateFilterSelectivity(cond2, update =
false).getOrElse(1.0)
Some(percent1 + percent2 - (percent1 * percent2))
// Not-operator pushdown
case Not(And(cond1, cond2)) =>
calculateFilterSelectivity(Or(Not(cond1), Not(cond2)), update =
false)
// Not-operator pushdown
case Not(Or(cond1, cond2)) =>
calculateFilterSelectivity(And(Not(cond1), Not(cond2)), update =
false)
// Collapse two consecutive Not operators which could be generated
after Not-operator pushdown
case Not(Not(cond)) =>
calculateFilterSelectivity(cond, update = false)
// The foldable Not has been processed in the ConstantFolding rule
// This is a top-down traversal. The Not could be pushed down by the
above two cases.
case Not(l @ Literal(null, _)) =>
calculateSingleCondition(l, update = false).map(boundProbability(_))
case Not(cond) =>
calculateFilterSelectivity(cond, update = false) match {
case Some(percent) => Some(1.0 - percent)
case None => None
}
case _ =>
calculateSingleCondition(condition, update).map(boundProbability(_))
}
}
````
--
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]