aokolnychyi commented on a change in pull request #1955:
URL: https://github.com/apache/iceberg/pull/1955#discussion_r545702382
##########
File path:
spark3-extensions/src/main/scala/org/apache/spark/sql/catalyst/optimizer/RewriteDelete.scala
##########
@@ -77,33 +101,30 @@ object RewriteDelete extends Rule[LogicalPlan] with
PredicateHelper with Logging
PushDownUtils.pushFilters(scanBuilder, normalizedPredicates)
val scan = scanBuilder.build()
- val scanRelation = DataSourceV2ScanRelation(table, scan, output)
+ val scanRelation = DataSourceV2ScanRelation(table, scan,
toOutputAttrs(scan.readSchema(), output))
val scanPlan = scan match {
- case _: SupportsFileFilter =>
+ case filterable: SupportsFileFilter =>
val matchingFilePlan = buildFileFilterPlan(cond, scanRelation)
- val dynamicFileFilter = DynamicFileFilter(scanRelation,
matchingFilePlan)
+ val dynamicFileFilter =
DynamicFileFilter(ExtendedScanRelation(scanRelation), matchingFilePlan,
filterable)
dynamicFileFilter
case _ =>
scanRelation
}
- // include file name so that we can group data back
- val fileNameExpr = Alias(InputFileName(), FILE_NAME_COL)()
- Project(scanPlan.output :+ fileNameExpr, scanPlan)
+ scanPlan
}
private def buildWritePlan(
remainingRowsPlan: LogicalPlan,
output: Seq[AttributeReference]): LogicalPlan = {
- // TODO: sort by _pos to keep the original ordering of rows
- // TODO: consider setting a file size limit
-
val fileNameCol = findOutputAttr(remainingRowsPlan, FILE_NAME_COL)
+ val rowPosCol = findOutputAttr(remainingRowsPlan, ROW_POS_COL)
+ val order = Seq(SortOrder(fileNameCol, Ascending), SortOrder(rowPosCol,
Ascending))
Review comment:
+1
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]