metanil commented on PR #55885: URL: https://github.com/apache/spark/pull/55885#issuecomment-7087139002
@sunchao thanks for the review again. I reproduced each case end to end on this branch and on master (`98bbfe5`), comparing against the same query with `spark.sql.sources.v2.bucketing.enabled=false`. The fixes are in `187d26b`. **Item 1.** See: https://github.com/apache/spark/pull/55885#issuecomment-7059292506 **Item 2. Signed-zero.** Confirmed and new here: a join of `sign_flip(id, 0.0)` and `sign_flip(id, -0.0)` scans returned 0 of 2 rows with every combination of `allowCompatibleTransforms` and `pushPartValues`. I started with the raw bits in parameter identity, as you suggested, but local review kept finding more places that compare transforms: `UnionExec` merges its children's partitionings with `semanticEquals`, which still equated the two, so a union aggregate gave wrong counts, and the per-partition runtime bloom filter pairs the two sides' transforms with `isSameFunction`. Each needed its own handling, and a float nested in a struct or array parameter was still conflated. So I went the other way: a transform with a `FLOAT` or `DOUBLE` parameter, alone or nested, has no identity, and a scan partitioned by a transform without one reports no partitioning. Nothing then pairs, reduces or merges such a transform with another, by construction, and it is two small changes. What it cost s is SPJ for transforms with a floating point parameter, which no connector I know of has: Iceberg's parameters are integer bucket counts and widths. On master no transform with a parameter other than bucket's count reports a partitioning at all, so it's no regression. The join and union over `sign_flip` tables are tested end to end, and each half of the change fails them when reverted. The `Literal` equality you pointed to is master's and reaches past SPJ: since `Literal(0.0)` and `Literal(-0.0)` are `semanticEquals`, `SimplifyConditionals` folds `CAST(IF(id = 0, 0.0D, -0.0D) AS STRING)` to `0.0` for every row on master. I filed that as [SPARK-62196](https://issues.apache.org/jira/browse/SPARK-62196). Once it's fixed, floating point parameters could get an identity here too. **3. The column's position.** See: https://github.com/apache/spark/pull/55885#issuecomment-7087046286 **4. `Int.MinValue`.** Confirmed, and in the test connector: `truncate(4)` against `truncate(6)` lost the `Int.MinValue` row, since width 6 wraps its key on write. `IntTruncateReducer` now takes the source width and unwraps a key that wrapped before reducing it, and truncating uses `Math.floorMod`, which local review found also overflowed for widths above 2^30. The integer truncate tables hold `Int.MinValue` now, and an exhaustive check over 7,396 width pairs near both ends of the int range found no mismatch. **5. Description.** Updated: `@since 4.5.0`, and the deprecated fallback is offered to any pair of V2 bucket transforms. -- 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]
