ConeyLiu commented on code in PR #8249:
URL: https://github.com/apache/iceberg/pull/8249#discussion_r1285537377


##########
spark/v3.4/spark-extensions/src/main/scala/org/apache/spark/sql/execution/datasources/v2/RowLevelCommandScanRelationPushDown.scala:
##########
@@ -122,16 +128,15 @@ object RowLevelCommandScanRelationPushDown extends 
Rule[LogicalPlan] with Predic
   private def pushFilters(
       cond: Expression,
       scanBuilder: ScanBuilder,
-      tableAttrs: Seq[AttributeReference]): (Seq[Filter], Seq[Predicate]) = {
+      tableAttrs: Seq[AttributeReference]): (Either[Seq[Filter], 
Seq[Predicate]], Seq[Expression]) = {
 
     val tableAttrSet = AttributeSet(tableAttrs)
     val filters = 
splitConjunctivePredicates(cond).filter(_.references.subsetOf(tableAttrSet))
     val normalizedFilters = DataSourceStrategy.normalizeExprs(filters, 
tableAttrs)
     val (_, normalizedFiltersWithoutSubquery) =
       normalizedFilters.partition(SubqueryExpression.hasSubquery)
 
-    val (pushedFilters, _) = PushDownUtils.pushFilters(scanBuilder, 
normalizedFiltersWithoutSubquery)
-    (pushedFilters.left.getOrElse(Seq.empty), 
pushedFilters.right.getOrElse(Seq.empty))

Review Comment:
   We should not get both the pushed and non-pushed from the first returning 
value because the returning pair of `PushDownUtils.pushFilters` should be 
`(pushedFilters, unpushedFilters)`.
   ```scala
       // PushDownUtils
       case r: SupportsPushDownFilters =>
       ...
       (Left(r.pushedFilters()), (postScanFilters ++ untranslatableExprs).toSeq)
   
       case r: SupportsPushDownV2Filters =>
       ...
       (Right(r.pushedPredicates), (postScanFilters ++ 
untranslatableExprs).toSeq)
   ```



-- 
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]

Reply via email to