cloud-fan commented on a change in pull request #35768:
URL: https://github.com/apache/spark/pull/35768#discussion_r823417715
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala
##########
@@ -609,20 +543,67 @@ private[sql] object DataSourceV2Strategy {
}
protected[sql] def rebuildExpressionFromFilter(
- filter: V2Filter,
- translatedFilterToExpr: mutable.HashMap[V2Filter, Expression]):
Expression = {
- filter match {
- case and: V2And =>
- expressions.And(rebuildExpressionFromFilter(and.left,
translatedFilterToExpr),
- rebuildExpressionFromFilter(and.right, translatedFilterToExpr))
- case or: V2Or =>
- expressions.Or(rebuildExpressionFromFilter(or.left,
translatedFilterToExpr),
- rebuildExpressionFromFilter(or.right, translatedFilterToExpr))
- case not: V2Not =>
- expressions.Not(rebuildExpressionFromFilter(not.child,
translatedFilterToExpr))
- case other =>
- translatedFilterToExpr.getOrElse(other,
- throw new IllegalStateException("Failed to rebuild Expression for
filter: " + filter))
+ predicate: V2Predicate,
+ translatedFilterToExpr: mutable.HashMap[V2Predicate, Expression]):
Expression = {
+ predicate.name() match {
+ case "AND" =>
+ expressions.And(
+
rebuildExpressionFromFilter(predicate.children()(0).asInstanceOf[V2Predicate],
+ translatedFilterToExpr),
+
rebuildExpressionFromFilter(predicate.children()(1).asInstanceOf[V2Predicate],
+ translatedFilterToExpr))
+ case "OR" =>
+ expressions.Or(
+
rebuildExpressionFromFilter(predicate.children()(0).asInstanceOf[V2Predicate],
+ translatedFilterToExpr),
+
rebuildExpressionFromFilter(predicate.children()(1).asInstanceOf[V2Predicate],
+ translatedFilterToExpr))
+ case "NOT" =>
Review comment:
then we can still keep the
`org.apache.spark.sql.connector.expressions.filter` package and put these
classes there.
--
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]