You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "ConeyLiu (via GitHub)" <gi...@apache.org> on 2023/08/07 08:18:46 UTC

[GitHub] [iceberg] ConeyLiu commented on a diff in pull request #8249: Spark 3.4: Correct push down log of RowLevelCommandScanRelationPushDown

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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org