sunchao commented on code in PR #7233:
URL: https://github.com/apache/datafusion-comet/pull/7233#discussion_r4746927528
##########
spark/src/main/scala/org/apache/comet/rules/CometScanRule.scala:
##########
@@ -1184,6 +1184,18 @@ case class CometScanRule(session: SparkSession)
val topLevelIds = (metadata.tableSchema +: historicSchemas)
.flatMap(IcebergReflection.buildFieldIdMapping(_).values)
.toSet
+ // iceberg-rust turns each equality-delete row into a filter on
the key column and
+ // compares it with a file that still stores a narrower type
incorrectly, so a key
+ // that may have been promoted drops rows Spark keeps
(apache/iceberg-rust#3122). A
+ // dropped key exists only in the history, so every schema is
checked.
+ lazy val promotedKeyColumns = (Seq(metadata.tableSchema,
metadata.scanSchema) ++
Review Comment:
Could we collect promotion information once, keyed by equality field ID?
Here each historical schema runs through `promotedColumns`, which scans history
again for its columns. With 128 schemas, 100 columns and one unchanged equality
key I measured about 100 ms and 4 MB of allocation for this guard alone on the
driver. Unioning the resulting names also makes a new `id` (field 2, STRING)
fall back if an older `id` (field 1) was promoted INT → BIGINT and then
dropped. A single pass over the relevant IDs can still protect dropped keys and
keep the conservative name-mapping fallback. Please cover the drop/re-add case.
--
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]