NikitaMatskevich commented on code in PR #5724:
URL: https://github.com/apache/datafusion-comet/pull/5724#discussion_r4372183670
##########
spark/src/main/scala/org/apache/comet/serde/operator/CometIcebergNativeWrite.scala:
##########
@@ -1120,9 +1317,62 @@ object CometIcebergNativeWrite extends
CometOperatorSerde[IcebergWriteExec] {
// `option("write-parquet-compression-codec", "gzip")`) survive into the
native writer.
val resolvedWriteProperties =
IcebergReflection.getWritePropertiesFromSparkWrite(sparkWrite).getOrElse(Map.empty)
- val effectiveProperties = properties ++ resolvedWriteProperties
- val parquetSettings =
- IcebergWriteProtoTranslation.buildParquetSettings(effectiveProperties,
createdBy)
+ val effectiveProperties =
+ interpretedBloomFilterProperties(properties ++ resolvedWriteProperties)
+ val parquetPathByIcebergColumnName =
+ if
(IcebergWriteProtoTranslation.hasEnabledBloomFilters(effectiveProperties)) {
+ val resolution =
IcebergReflection.getParquetPathResolution(writeSchema).getOrElse {
+ withFallbackReason(op, "Could not resolve physical Parquet paths for
Bloom filters")
+ return None
+ }
+ val configuredColumns =
+
IcebergWriteProtoTranslation.enabledBloomFilterColumnNames(effectiveProperties)
+ val icebergVersion = IcebergReflection.icebergVersion()
+ val versionParts = icebergVersion.split("[.-]", 3)
+ val version =
+ if (versionParts.length >= 2) {
+ scala.util.Try((versionParts(0).toInt,
versionParts(1).toInt)).toOption
+ } else {
+ None
+ }
+ val resolvedPaths = version match {
+ case Some((1, minor)) if minor < 8 =>
+ // Iceberg 1.5 passes the configured name straight to parquet-mr.
+ configuredColumns.filter(resolution.physicalPaths).map(path =>
path -> path).toMap
+ case Some((1, minor)) if minor < 10 =>
+ // Iceberg 1.8 resolves canonical and short collection aliases
through field ids.
+ configuredColumns.flatMap { configuredName =>
+ IcebergReflection
+ .findFieldIdByName(writeSchema, configuredName)
+ .flatMap(resolution.pathByFieldId.get)
+ .map(configuredName -> _)
+ }.toMap
+ case _ =>
+ // Iceberg 1.10+ keys writer properties by canonical
findColumnName output.
+ resolution.pathByIcebergColumnName
Review Comment:
Thank you, this was fixed in commit `fix: ignore unconfigured columns in
Iceberg Bloom path checks`.
##########
spark/src/main/scala/org/apache/comet/serde/operator/CometIcebergNativeWrite.scala:
##########
@@ -1120,9 +1317,62 @@ object CometIcebergNativeWrite extends
CometOperatorSerde[IcebergWriteExec] {
// `option("write-parquet-compression-codec", "gzip")`) survive into the
native writer.
val resolvedWriteProperties =
IcebergReflection.getWritePropertiesFromSparkWrite(sparkWrite).getOrElse(Map.empty)
- val effectiveProperties = properties ++ resolvedWriteProperties
- val parquetSettings =
- IcebergWriteProtoTranslation.buildParquetSettings(effectiveProperties,
createdBy)
+ val effectiveProperties =
+ interpretedBloomFilterProperties(properties ++ resolvedWriteProperties)
+ val parquetPathByIcebergColumnName =
+ if
(IcebergWriteProtoTranslation.hasEnabledBloomFilters(effectiveProperties)) {
+ val resolution =
IcebergReflection.getParquetPathResolution(writeSchema).getOrElse {
+ withFallbackReason(op, "Could not resolve physical Parquet paths for
Bloom filters")
+ return None
+ }
+ val configuredColumns =
+
IcebergWriteProtoTranslation.enabledBloomFilterColumnNames(effectiveProperties)
+ val icebergVersion = IcebergReflection.icebergVersion()
+ val versionParts = icebergVersion.split("[.-]", 3)
+ val version =
+ if (versionParts.length >= 2) {
+ scala.util.Try((versionParts(0).toInt,
versionParts(1).toInt)).toOption
+ } else {
+ None
+ }
+ val resolvedPaths = version match {
+ case Some((1, minor)) if minor < 8 =>
+ // Iceberg 1.5 passes the configured name straight to parquet-mr.
+ configuredColumns.filter(resolution.physicalPaths).map(path =>
path -> path).toMap
+ case Some((1, minor)) if minor < 10 =>
+ // Iceberg 1.8 resolves canonical and short collection aliases
through field ids.
+ configuredColumns.flatMap { configuredName =>
+ IcebergReflection
+ .findFieldIdByName(writeSchema, configuredName)
+ .flatMap(resolution.pathByFieldId.get)
+ .map(configuredName -> _)
+ }.toMap
+ case _ =>
Review Comment:
Thank you, this was fixed in commit `fix: fall back for unidentified Iceberg
Bloom naming conventions`.
--
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]