comphead commented on code in PR #5724:
URL: https://github.com/apache/datafusion-comet/pull/5724#discussion_r4669997664


##########
spark/src/main/scala/org/apache/comet/serde/operator/CometIcebergNativeWrite.scala:
##########
@@ -1463,9 +1777,49 @@ 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.configuredBloomFilterColumnNames(effectiveProperties)
+        val enabledColumns =
+          
IcebergWriteProtoTranslation.enabledBloomFilterColumnNames(effectiveProperties).toSet
+        val resolvedPaths =
+          bloomFilterParquetPaths(configuredColumns, resolution, schema = 
writeSchema) match {

Review Comment:
   `requireSupportedBloomFilterPaths` already resolves these paths in 
`getSupportLevel` from the same table and write properties and the same write 
schema, so this second `getParquetPathResolution` and `bloomFilterParquetPaths` 
pass repeats the reflection, and its `Left` branch is reachable only if the two 
drift apart. The renamed-path check below is now the one Bloom path rule that 
lives only here, so `getSupportLevel` reports `Compatible` for an enabled 
column Iceberg renames and `CometIcebergWriteDetectionSuite` cannot see that 
fallback. Could the renamed check move into `requireSupportedBloomFilterPaths` 
next to the FLOAT/DOUBLE check, leaving this block to only look up the paths it 
serializes?



##########
spark/src/main/scala/org/apache/comet/serde/operator/CometIcebergNativeWrite.scala:
##########
@@ -792,6 +802,310 @@ object CometIcebergNativeWrite extends 
CometOperatorSerde[IcebergWriteExec] {
       case _: ClassNotFoundException | _: LinkageError => false
     }
 
+  // These are Apache Parquet Java BlockSplitBloomFilter implementation 
bounds, not Iceberg
+  // TableProperties constants, so they cannot be obtained through 
IcebergReflection:
+  // scalastyle:off line.size.limit
+  // 
https://github.com/apache/parquet-java/blob/78a8d3230eb4769db93de5f2f2e18363c04cae81/parquet-column/src/main/java/org/apache/parquet/column/values/bloomfilter/BlockSplitBloomFilter.java#L40-L50
+  // scalastyle:on line.size.limit
+  private[operator] val MinBloomFilterBytes = 32
+  private[operator] val MaxBloomFilterBytes = 128 * 1024 * 1024
+  private val BloomFilterHashProbes = 8
+  private val MaxNonOverflowingBloomFilterNdv = Long.MaxValue / 
BloomFilterHashProbes
+
+  /**
+   * Keep only Bloom shape properties interpreted by the Iceberg runtime on 
the classpath. Older
+   * Iceberg releases leave these table properties untouched but do not pass 
them to parquet-mr.
+   * Ignoring them here preserves that version's JVM-writer behavior while 
allowing the remaining
+   * supported Bloom configuration to execute natively.
+   */
+  private def interpretedBloomFilterProperties(
+      properties: Map[String, String]): Map[String, String] = {
+    val unsupportedPrefixes = Seq(
+      PropertyKeys.ParquetBloomFilterColumnFppPrefix ->
+        "PARQUET_BLOOM_FILTER_COLUMN_FPP_PREFIX",
+      PropertyKeys.ParquetBloomFilterColumnNdvPrefix ->
+        "PARQUET_BLOOM_FILTER_COLUMN_NDV_PREFIX").collect {
+      case (prefix, constant) if 
IcebergReflection.tablePropertyConstantOpt(constant).isEmpty =>
+        prefix
+    }
+    properties.filterNot { case (key, _) => 
unsupportedPrefixes.exists(key.startsWith) }
+  }
+
+  /**
+   * parquet-rs 59.3.0 initially represents Bloom filters as a power-of-two 
number of bytes and
+   * may fold that allocation after values are inserted. parquet-mr accepts 
arbitrary caps and,
+   * when one binds, serializes that exact length. Keep those writes on the 
classic path instead
+   * of silently changing the number of usable Bloom blocks.
+   */
+  private val requireNativeSupportedBloomFilterProperties: TriggerRule = ctx 
=> {
+    val properties = interpretedBloomFilterProperties(ctx.properties)
+    val configuredMaxBytes = 
properties.get(PropertyKeys.ParquetBloomFilterMaxBytes).map { raw =>
+      raw -> scala.util.Try(java.lang.Integer.parseInt(raw)).toOption
+    }
+    val malformedMaxRejection = configuredMaxBytes.collect {
+      case (raw, None) =>
+        s"${PropertyKeys.ParquetBloomFilterMaxBytes}=$raw is not a Java int"
+      case (raw, Some(value)) if value <= 0 =>
+        s"${PropertyKeys.ParquetBloomFilterMaxBytes}=$raw must be positive"
+    }
+    // Iceberg visits every enabled-prefix entry and applies enabled, FPP, 
then NDV. With no such
+    // entry, a positive, parseable maximum cannot affect the file and must 
not force an
+    // otherwise-compatible write onto the classic path. Keep rejecting 
malformed and
+    // non-positive values because Iceberg validates them even with no Bloom 
column.
+    val configured = 
IcebergWriteProtoTranslation.configuredBloomFilterColumnNames(properties)
+    if (configured.isEmpty) {
+      malformedMaxRejection
+    } else {
+      val maxRejection = malformedMaxRejection.orElse {
+        configuredMaxBytes.collect {
+          case (_, Some(value))
+              if value < MinBloomFilterBytes || value > MaxBloomFilterBytes ||
+                (value & (value - 1)) != 0 =>
+            s"${PropertyKeys.ParquetBloomFilterMaxBytes}=$value must be a 
power of two " +
+              s"in [$MinBloomFilterBytes, $MaxBloomFilterBytes] for native 
writes"
+        }
+      }
+
+      maxRejection.orElse {
+        val maxBytes = configuredMaxBytes
+          .flatMap(_._2)
+          .getOrElse(IcebergWriteProtoTranslation.Defaults.BloomFilterMaxBytes)
+        // Validate associated shape properties even for enabled=false; a 
valid NDV re-enables
+        // the filter in parquet-mr.
+        configured.iterator
+          .flatMap { column =>
+            val fppKey = PropertyKeys.ParquetBloomFilterColumnFppPrefix + 
column
+            val ndvKey = PropertyKeys.ParquetBloomFilterColumnNdvPrefix + 
column
+            val parsedFpp = properties.get(fppKey) match {
+              case Some(raw) => 
scala.util.Try(java.lang.Double.parseDouble(raw)).toOption
+              case None => 
Some(IcebergWriteProtoTranslation.Defaults.BloomFilterFpp)
+            }
+            val parsedNdv = properties
+              .get(ndvKey)
+              .flatMap(raw => 
scala.util.Try(java.lang.Long.parseLong(raw)).toOption)
+            val fppError = properties.get(fppKey).flatMap { raw =>
+              parsedFpp match {
+                case Some(value)
+                    if value > 0.0d && value < 1.0d && 
java.lang.Double.isFinite(value) &&
+                      bloomFilterSizesRepresentable(maxBytes, value) =>
+                  None
+                case Some(value)
+                    if value > 0.0d && value < 1.0d && 
java.lang.Double.isFinite(value) =>
+                  Some(s"$fppKey=$raw cannot represent the configured native 
Bloom sizes")
+                case _ => Some(s"$fppKey=$raw must be a finite double strictly 
between 0 and 1")
+              }
+            }
+            val ndvError = properties.get(ndvKey).flatMap { raw =>
+              parsedNdv match {
+                case Some(value) if value > 0L && value <= 
MaxNonOverflowingBloomFilterNdv => None
+                case Some(value) if value > MaxNonOverflowingBloomFilterNdv =>
+                  Some(s"$ndvKey=$raw exceeds 
$MaxNonOverflowingBloomFilterNdv; " +
+                    "parquet-mr Bloom sizing may overflow")
+                case _ => Some(s"$ndvKey=$raw must be a positive Java long")
+              }
+            }
+            val ignoredMinimumCapError = parsedNdv.collect {
+              case ndv
+                  if maxBytes == MinBloomFilterBytes && ndv > 0L &&
+                    ndv <= MaxNonOverflowingBloomFilterNdv &&
+                    parsedFpp.exists(
+                      parquetMrRequestedBloomFilterBytes(ndv, _) > 
MinBloomFilterBytes) =>
+                
s"${PropertyKeys.ParquetBloomFilterMaxBytes}=$MinBloomFilterBytes is ignored by 
" +
+                  s"parquet-mr for $ndvKey=$ndv"
+            }
+            Seq(fppError, ndvError, ignoredMinimumCapError).flatten
+          }
+          .toSeq
+          .headOption
+      }
+    }
+  }
+
+  private val requireSupportedBloomFilterRuntime: TriggerRule = ctx => {
+    val prefixes = Seq(
+      PropertyKeys.BloomFilterColumnEnabledPrefix,
+      PropertyKeys.ParquetBloomFilterColumnFppPrefix,
+      PropertyKeys.ParquetBloomFilterColumnNdvPrefix)
+    if (ctx.properties.keys.exists(key => prefixes.exists(key.startsWith))) {
+      bloomFilterRuntimeRejection(IcebergReflection.icebergVersion(), 
ctx.properties)
+    } else {
+      None
+    }
+  }
+
+  private def bloomFilterVersion(icebergVersion: String): Option[(Int, Int)] = 
{
+    if 
(Option(icebergVersion).exists(_.matches("\\d+\\.\\d+\\.\\d+(?:[-+].+)?"))) {
+      val parts = icebergVersion.split("[.-]", 3)
+      scala.util.Try((parts(0).toInt, parts(1).toInt)).toOption
+    } else {
+      None
+    }
+  }
+
+  private[operator] def bloomFilterRuntimeRejection(
+      icebergVersion: String,
+      properties: Map[String, String] = Map.empty): Option[String] = {
+    bloomFilterVersion(icebergVersion) match {
+      case Some((1, minor))
+          if (minor == 6 || minor == 7) && properties.keys.exists(
+            _.startsWith(PropertyKeys.ParquetBloomFilterColumnFppPrefix)) =>
+        Some(
+          s"Iceberg $icebergVersion applies 
${PropertyKeys.ParquetBloomFilterColumnFppPrefix}* " +
+            "independently; these settings require Java validation")
+      case Some((1, minor)) if minor >= 5 => None
+      case Some((1, _)) =>
+        Some(s"Native Bloom writes require Iceberg 1.5 or later; found 
'$icebergVersion'")
+      case _ =>
+        Some(
+          s"Cannot determine Iceberg Bloom column-name convention for version 
'$icebergVersion'")
+    }
+  }
+
+  private val requireSupportedBloomFilterPaths: TriggerRule = ctx => {
+    // Resolve disabled entries too: a second spelling can disable or change 
the same leaf.
+    val columns = 
IcebergWriteProtoTranslation.configuredBloomFilterColumnNames(ctx.properties)
+    if (columns.isEmpty) {
+      None
+    } else {
+      val schema = IcebergReflection
+        .getWriteSchemaFromSparkWrite(ctx.sparkWrite)
+        .getOrElse(throw new IllegalStateException("Could not resolve Bloom 
write schema"))
+      val resolution = IcebergReflection
+        .getParquetPathResolution(schema)
+        .getOrElse(throw new IllegalStateException("Could not resolve Bloom 
Parquet paths"))
+      bloomFilterParquetPaths(columns, resolution, schema = schema) match {
+        case Left(reason) => Some(reason)
+        case Right(paths) =>
+          val properties = interpretedBloomFilterProperties(ctx.properties)
+          val enabled = 
IcebergWriteProtoTranslation.enabledBloomFilterColumnNames(properties)
+          val affected = enabled.filter { column =>
+            
paths.get(column).exists(resolution.floatingPointPhysicalPaths.contains)
+          }
+          if (affected.isEmpty) {
+            None
+          } else {
+            // SQL-equal NaNs can have different payloads. Preserve Java's 
writer until the
+            // native writer canonicalizes these values before hashing them.
+            Some(
+              s"Bloom filters on FLOAT/DOUBLE columns 
${affected.sorted.mkString(", ")} " +
+                "require the Java writer to preserve NaN equality")
+          }
+      }
+    }
+  }
+
+  private[operator] def bloomFilterParquetPaths(
+      configuredColumns: Seq[String],
+      resolution: IcebergReflection.ParquetPathResolution,
+      icebergVersion: String = IcebergReflection.icebergVersion(),
+      schema: Any = null): Either[String, Map[String, String]] = {
+    val paths = bloomFilterVersion(icebergVersion) match {
+      case Some((1, minor)) if minor >= 5 && minor < 8 =>

Review Comment:
   No CI job runs this branch, or the 1.6/1.7 FPP rule in 
`bloomFilterRuntimeRejection`, end to end. Since 
https://github.com/apache/datafusion-comet/pull/7521 removed the Spark 3.4 
profile, the Comet suites pin Iceberg 1.8.1, 1.10.0 and 1.11.0, and the Iceberg 
Spark tests run 1.9.1, 1.10.0 and 1.11.0. So `legacy trailing-dot Bloom paths 
match Java filters`, `legacy physical nested bloom paths execute natively and 
match Java`, `legacy independent FPP validation selects Java even without 
enabled columns` and the two `!icebergVersionAtLeast(1, 8)` cases in 
`CometIcebergWriteDetectionSuite` cancel on every run, including the 
`run-all-spark-profiles` and `run-iceberg-tests` ones. Only the string-level 
cases in `IcebergWriteProtoTranslationSuite` cover it. andygrove asked for the 
legacy support here, so I am not asking to drop it, but the manual 
`-Diceberg.spark.runtime.version=1.7.2` command in `iceberg-writes.md` relies 
on someone rerunning it after every change to this gate. Could a CI
  row run the Spark 3.5 Iceberg write suites with the override at 1.5.2 and 
1.7.2? If that is too much CI for two old runtimes, keeping enabled Bloom 
columns on Java below 1.8 (with `enabled=false` still native) would remove the 
raw-path branch, the 1.6/1.7 rule and the POM property.



##########
spark/src/main/scala/org/apache/comet/serde/operator/CometIcebergNativeWrite.scala:
##########
@@ -792,6 +802,310 @@ object CometIcebergNativeWrite extends 
CometOperatorSerde[IcebergWriteExec] {
       case _: ClassNotFoundException | _: LinkageError => false
     }
 
+  // These are Apache Parquet Java BlockSplitBloomFilter implementation 
bounds, not Iceberg
+  // TableProperties constants, so they cannot be obtained through 
IcebergReflection:
+  // scalastyle:off line.size.limit
+  // 
https://github.com/apache/parquet-java/blob/78a8d3230eb4769db93de5f2f2e18363c04cae81/parquet-column/src/main/java/org/apache/parquet/column/values/bloomfilter/BlockSplitBloomFilter.java#L40-L50
+  // scalastyle:on line.size.limit
+  private[operator] val MinBloomFilterBytes = 32
+  private[operator] val MaxBloomFilterBytes = 128 * 1024 * 1024
+  private val BloomFilterHashProbes = 8
+  private val MaxNonOverflowingBloomFilterNdv = Long.MaxValue / 
BloomFilterHashProbes
+
+  /**
+   * Keep only Bloom shape properties interpreted by the Iceberg runtime on 
the classpath. Older
+   * Iceberg releases leave these table properties untouched but do not pass 
them to parquet-mr.
+   * Ignoring them here preserves that version's JVM-writer behavior while 
allowing the remaining
+   * supported Bloom configuration to execute natively.
+   */
+  private def interpretedBloomFilterProperties(
+      properties: Map[String, String]): Map[String, String] = {
+    val unsupportedPrefixes = Seq(
+      PropertyKeys.ParquetBloomFilterColumnFppPrefix ->
+        "PARQUET_BLOOM_FILTER_COLUMN_FPP_PREFIX",
+      PropertyKeys.ParquetBloomFilterColumnNdvPrefix ->
+        "PARQUET_BLOOM_FILTER_COLUMN_NDV_PREFIX").collect {
+      case (prefix, constant) if 
IcebergReflection.tablePropertyConstantOpt(constant).isEmpty =>
+        prefix
+    }
+    properties.filterNot { case (key, _) => 
unsupportedPrefixes.exists(key.startsWith) }
+  }
+
+  /**
+   * parquet-rs 59.3.0 initially represents Bloom filters as a power-of-two 
number of bytes and
+   * may fold that allocation after values are inserted. parquet-mr accepts 
arbitrary caps and,
+   * when one binds, serializes that exact length. Keep those writes on the 
classic path instead
+   * of silently changing the number of usable Bloom blocks.
+   */
+  private val requireNativeSupportedBloomFilterProperties: TriggerRule = ctx 
=> {
+    val properties = interpretedBloomFilterProperties(ctx.properties)
+    val configuredMaxBytes = 
properties.get(PropertyKeys.ParquetBloomFilterMaxBytes).map { raw =>
+      raw -> scala.util.Try(java.lang.Integer.parseInt(raw)).toOption
+    }
+    val malformedMaxRejection = configuredMaxBytes.collect {
+      case (raw, None) =>
+        s"${PropertyKeys.ParquetBloomFilterMaxBytes}=$raw is not a Java int"
+      case (raw, Some(value)) if value <= 0 =>
+        s"${PropertyKeys.ParquetBloomFilterMaxBytes}=$raw must be positive"
+    }
+    // Iceberg visits every enabled-prefix entry and applies enabled, FPP, 
then NDV. With no such
+    // entry, a positive, parseable maximum cannot affect the file and must 
not force an
+    // otherwise-compatible write onto the classic path. Keep rejecting 
malformed and
+    // non-positive values because Iceberg validates them even with no Bloom 
column.
+    val configured = 
IcebergWriteProtoTranslation.configuredBloomFilterColumnNames(properties)
+    if (configured.isEmpty) {
+      malformedMaxRejection
+    } else {
+      val maxRejection = malformedMaxRejection.orElse {
+        configuredMaxBytes.collect {
+          case (_, Some(value))
+              if value < MinBloomFilterBytes || value > MaxBloomFilterBytes ||
+                (value & (value - 1)) != 0 =>
+            s"${PropertyKeys.ParquetBloomFilterMaxBytes}=$value must be a 
power of two " +
+              s"in [$MinBloomFilterBytes, $MaxBloomFilterBytes] for native 
writes"
+        }
+      }
+
+      maxRejection.orElse {
+        val maxBytes = configuredMaxBytes
+          .flatMap(_._2)
+          .getOrElse(IcebergWriteProtoTranslation.Defaults.BloomFilterMaxBytes)
+        // Validate associated shape properties even for enabled=false; a 
valid NDV re-enables
+        // the filter in parquet-mr.
+        configured.iterator
+          .flatMap { column =>
+            val fppKey = PropertyKeys.ParquetBloomFilterColumnFppPrefix + 
column
+            val ndvKey = PropertyKeys.ParquetBloomFilterColumnNdvPrefix + 
column
+            val parsedFpp = properties.get(fppKey) match {
+              case Some(raw) => 
scala.util.Try(java.lang.Double.parseDouble(raw)).toOption
+              case None => 
Some(IcebergWriteProtoTranslation.Defaults.BloomFilterFpp)
+            }
+            val parsedNdv = properties
+              .get(ndvKey)
+              .flatMap(raw => 
scala.util.Try(java.lang.Long.parseLong(raw)).toOption)
+            val fppError = properties.get(fppKey).flatMap { raw =>
+              parsedFpp match {
+                case Some(value)
+                    if value > 0.0d && value < 1.0d && 
java.lang.Double.isFinite(value) &&
+                      bloomFilterSizesRepresentable(maxBytes, value) =>
+                  None
+                case Some(value)
+                    if value > 0.0d && value < 1.0d && 
java.lang.Double.isFinite(value) =>
+                  Some(s"$fppKey=$raw cannot represent the configured native 
Bloom sizes")
+                case _ => Some(s"$fppKey=$raw must be a finite double strictly 
between 0 and 1")
+              }
+            }
+            val ndvError = properties.get(ndvKey).flatMap { raw =>
+              parsedNdv match {
+                case Some(value) if value > 0L && value <= 
MaxNonOverflowingBloomFilterNdv => None
+                case Some(value) if value > MaxNonOverflowingBloomFilterNdv =>
+                  Some(s"$ndvKey=$raw exceeds 
$MaxNonOverflowingBloomFilterNdv; " +
+                    "parquet-mr Bloom sizing may overflow")
+                case _ => Some(s"$ndvKey=$raw must be a positive Java long")
+              }
+            }
+            val ignoredMinimumCapError = parsedNdv.collect {
+              case ndv
+                  if maxBytes == MinBloomFilterBytes && ndv > 0L &&
+                    ndv <= MaxNonOverflowingBloomFilterNdv &&
+                    parsedFpp.exists(
+                      parquetMrRequestedBloomFilterBytes(ndv, _) > 
MinBloomFilterBytes) =>
+                
s"${PropertyKeys.ParquetBloomFilterMaxBytes}=$MinBloomFilterBytes is ignored by 
" +
+                  s"parquet-mr for $ndvKey=$ndv"
+            }
+            Seq(fppError, ndvError, ignoredMinimumCapError).flatten
+          }
+          .toSeq
+          .headOption
+      }
+    }
+  }
+
+  private val requireSupportedBloomFilterRuntime: TriggerRule = ctx => {
+    val prefixes = Seq(
+      PropertyKeys.BloomFilterColumnEnabledPrefix,
+      PropertyKeys.ParquetBloomFilterColumnFppPrefix,
+      PropertyKeys.ParquetBloomFilterColumnNdvPrefix)
+    if (ctx.properties.keys.exists(key => prefixes.exists(key.startsWith))) {
+      bloomFilterRuntimeRejection(IcebergReflection.icebergVersion(), 
ctx.properties)
+    } else {
+      None
+    }
+  }
+
+  private def bloomFilterVersion(icebergVersion: String): Option[(Int, Int)] = 
{
+    if 
(Option(icebergVersion).exists(_.matches("\\d+\\.\\d+\\.\\d+(?:[-+].+)?"))) {
+      val parts = icebergVersion.split("[.-]", 3)
+      scala.util.Try((parts(0).toInt, parts(1).toInt)).toOption
+    } else {
+      None
+    }
+  }
+
+  private[operator] def bloomFilterRuntimeRejection(
+      icebergVersion: String,
+      properties: Map[String, String] = Map.empty): Option[String] = {
+    bloomFilterVersion(icebergVersion) match {
+      case Some((1, minor))
+          if (minor == 6 || minor == 7) && properties.keys.exists(
+            _.startsWith(PropertyKeys.ParquetBloomFilterColumnFppPrefix)) =>
+        Some(
+          s"Iceberg $icebergVersion applies 
${PropertyKeys.ParquetBloomFilterColumnFppPrefix}* " +
+            "independently; these settings require Java validation")
+      case Some((1, minor)) if minor >= 5 => None
+      case Some((1, _)) =>
+        Some(s"Native Bloom writes require Iceberg 1.5 or later; found 
'$icebergVersion'")
+      case _ =>
+        Some(
+          s"Cannot determine Iceberg Bloom column-name convention for version 
'$icebergVersion'")
+    }
+  }
+
+  private val requireSupportedBloomFilterPaths: TriggerRule = ctx => {
+    // Resolve disabled entries too: a second spelling can disable or change 
the same leaf.
+    val columns = 
IcebergWriteProtoTranslation.configuredBloomFilterColumnNames(ctx.properties)
+    if (columns.isEmpty) {
+      None
+    } else {
+      val schema = IcebergReflection
+        .getWriteSchemaFromSparkWrite(ctx.sparkWrite)
+        .getOrElse(throw new IllegalStateException("Could not resolve Bloom 
write schema"))
+      val resolution = IcebergReflection
+        .getParquetPathResolution(schema)
+        .getOrElse(throw new IllegalStateException("Could not resolve Bloom 
Parquet paths"))
+      bloomFilterParquetPaths(columns, resolution, schema = schema) match {
+        case Left(reason) => Some(reason)
+        case Right(paths) =>
+          val properties = interpretedBloomFilterProperties(ctx.properties)
+          val enabled = 
IcebergWriteProtoTranslation.enabledBloomFilterColumnNames(properties)
+          val affected = enabled.filter { column =>
+            
paths.get(column).exists(resolution.floatingPointPhysicalPaths.contains)
+          }
+          if (affected.isEmpty) {
+            None
+          } else {
+            // SQL-equal NaNs can have different payloads. Preserve Java's 
writer until the
+            // native writer canonicalizes these values before hashing them.
+            Some(
+              s"Bloom filters on FLOAT/DOUBLE columns 
${affected.sorted.mkString(", ")} " +
+                "require the Java writer to preserve NaN equality")
+          }
+      }
+    }
+  }
+
+  private[operator] def bloomFilterParquetPaths(
+      configuredColumns: Seq[String],
+      resolution: IcebergReflection.ParquetPathResolution,
+      icebergVersion: String = IcebergReflection.icebergVersion(),
+      schema: Any = null): Either[String, Map[String, String]] = {

Review Comment:
   Both production callers pass `schema`, and on 1.8/1.9 a call without it 
reaches `findFieldIdByName(null, ...)` and fails with a `NullPointerException` 
on `schema.getClass`. Could `schema` (and `icebergVersion`) be required 
parameters, with the `IcebergWriteProtoTranslationSuite` cases that never reach 
the 1.8/1.9 branch passing them explicitly?



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