dongjoon-hyun commented on code in PR #37197:
URL: https://github.com/apache/spark/pull/37197#discussion_r926261840
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala:
##########
@@ -502,11 +502,31 @@ private[sql] object DataSourceV2Strategy {
private def translateLeafNodeFilterV2(predicate: Expression):
Option[Predicate] = {
predicate match {
- case PushablePredicate(expr) => Some(expr)
+ case PushablePredicate(expr) =>
+ if (expr.children().length == 2) {
+ expr.children()(0) match {
+ case LiteralValue(_, _) =>
+ Some(new Predicate(flipComparisonFilterName(expr.name()),
+ Array(expr.children()(1), expr.children()(0))))
+ case _ => Some(expr)
+ }
+ } else {
+ Some(expr)
+ }
case _ => None
}
}
+ private def flipComparisonFilterName(filterName: String): String = {
+ filterName match {
+ case ">" => "<"
+ case "<" => ">"
+ case ">=" => "<="
+ case "<=" => ">="
+ case _ => filterName
Review Comment:
We don't need to flip the operator, `=`, do we? @zinking
The operands are flipped already via `Array(expr.children()(1),
expr.children()(0))`.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]