MaxGekk commented on code in PR #57701:
URL: https://github.com/apache/spark/pull/57701#discussion_r4640579038
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/columnar/ColumnStats.scala:
##########
@@ -221,8 +222,14 @@ private[columnar] final class FloatColumnStats extends
ColumnStats {
}
def gatherValueStats(value: Float): Unit = {
- if (value > upper) upper = value
- if (value < lower) lower = value
+ // Cache pruning evaluates Catalyst comparisons, where NaN sorts after
finite values.
Review Comment:
nit: NaN sorts after `+Infinity` too under
`SQLOrderingUtil.compareFloats`/`compareDoubles`, so "NaN sorts after finite
values" could suggest that an upper bound of `+Infinity` already covers NaN.
How about "NaN sorts after all non-NaN values, including `+Infinity`"? The same
wording is in `DoubleColumnStats` and both
`ArrowCachedBatchSerializer.calculateMinMax*` helpers.
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/columnar/PartitionBatchPruningSuite.scala:
##########
@@ -106,6 +108,40 @@ class PartitionBatchPruningSuite extends
SharedSparkSession with AdaptiveSparkPl
checkBatchPruning("SELECT key FROM pruningData WHERE 11 >= key", 1, 2)(1 to
11)
checkBatchPruning("SELECT key FROM pruningData WHERE 88 < key", 1, 2)(89 to
100)
checkBatchPruning("SELECT key FROM pruningData WHERE 89 <= key", 1, 2)(89 to
100)
+
+ test("SPARK-58482: floating-point NaN bounds preserve range pruning") {
Review Comment:
The pruning test checks only range predicates. Could it also check `=== NaN`
and `isin(NaN)` against batches that mix finite values and NaN, for float and
double? Those take the `lowerBound <= l && l <= upperBound` branch of
`buildFilter`, and `InMemoryColumnarQuerySuite` checks their results but not
the batch count.
--
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]