sunchao commented on PR #55885: URL: https://github.com/apache/spark/pull/55885#issuecomment-7046189335
I’d block [Spark #55885](https://github.com/apache/spark/pull/55885) on two wrong-result cases. Five agents reviewed commit `aa57d17`, and I checked the findings against all 68 inline threads and the top-level discussion. The drafts below reflect the latest agreement to remove the reducer memo, propagate connector failures, and preserve the legacy fallback for any two V2 buckets. All five comments are **drafts in this chat only**. [Latest review](https://github.com/apache/spark/pull/55885#pullrequestreview-5976770138) · [Author’s response](https://github.com/apache/spark/pull/55885#issuecomment-7032526965) ### Blocking comments **1. [P1] Truncation can split one logical window across two tasks.** The earlier discussion covered how skipping the shuffle changes parallelism. For a collated column it can also change the result. Spark explicitly tests that `İ` (`U+0130`) and `i` followed by a combining dot (`U+0069 U+0307`) compare equal under `UTF8_LCASE`. Truncating each to one code point produces `İ` and `i`, which compare differently under that same collation. A V2 scan partitioned by `truncate(s, 1)` can therefore legitimately report one split per truncated key. [Earlier discussion](https://github.com/apache/spark/pull/55885#discussion_r4340180612) · [Spark’s equality test](https://github.com/apache/spark/blob/aa57d17f070f0747c246adfa961ab5932542f321/common/unsafe/src/test/java/org/apache/spark/unsafe/types/CollationSupportSuite.java#L113) For `SELECT count(*) OVER (PARTITION BY s) FROM t`, the new check admits this layout, and `isFunctionOfClusterKeys` accepts it because `s` is the transform’s only reference. Each task sees one row and returns `1`. The base commit shuffles by `s`, bringing both rows into the same window and returning `2` for each. Could we preserve the shuffle for a collated input unless the transform preserves its equality semantics, and add this two-row window regression? [Proposed inline location](codex://review?pr=https%3A%2F%2Fgithub.com%2Fapache%2Fspark%2Fpull%2F55885&path=sql%2Fcatalyst%2Fsrc%2Fmain%2Fscala%2Forg%2Fapache%2Fspark%2Fsql%2Fcatalyst%2Fplans%2Fphysical%2Fpartitioning.scala&line=1302&side=right) · [Clustering decision](https://github.com/apache/spark/blob/aa57d17f070f0747c246adfa961ab5932542f321/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/physical/partitioning.scala#L1062) · [Window equality](https://github.com/apache/spark/blob/aa57d17f070f0747c246adfa961 ab5932542f321/sql/core/src/main/scala/org/apache/spark/sql/execution/window/WindowEvaluatorFactory.scala#L67) **2. [P1] Signed-zero parameters can make SPJ pair the wrong partitions.** The earlier raw-key fix relies on `isSameFunction` identifying transforms that place matching rows under the same key. `ArgumentShape.Param(l)` now delegates to `Literal.equals`, which equates `+0.0d` and `-0.0d`. A deterministic connector can observe the sign through `Math.copySign`. Consider a transform that returns `id` for a positive sign and `-id` for a negative sign. Both tables contain integer IDs `{-1, 1}`, with parameter `+0.0d` on the left and `-0.0d` on the right. Both scans report keys `[-1, 1]`, but each key holds opposite IDs across the two scans. `isSameFunction` accepts the pair even with compatible-transform reduction disabled, so a merge join on `id` loses both matches. Could we use the raw `Float` and `Double` bits in parameter identity and cover this case with a join regression? [Proposed inline location](codex://review?pr=https%3A%2F%2Fgithub.com%2Fapache%2Fspark%2Fpull%2F55885&path=sql %2Fcatalyst%2Fsrc%2Fmain%2Fscala%2Forg%2Fapache%2Fspark%2Fsql%2Fcatalyst%2Fexpressions%2FTransformExpression.scala&line=197&side=right) · [Literal equality](https://github.com/apache/spark/blob/aa57d17f070f0747c246adfa961ab5932542f321/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala#L579) · [Earlier raw-key fix](https://github.com/apache/spark/pull/55885#issuecomment-5760079728) ### Additional comments **3. [P2] Give the connector the column’s argument position.** `sameArgumentLayout` addresses the earlier concern about the two sides disagreeing on the column position. There’s still an ambiguity when the two sides agree. For a stateless `subtract(INT, INT)` bound on two non-nullable operands, reducing `subtract(id, 1)` onto `subtract(id, 2)` requires mapping the stored key `k` to `k − 1`. Reducing `subtract(1, id)` onto `subtract(2, id)` requires `k + 1`. Both pairs pass the layout check, and both produce the identical call `reducer([1], otherFunction, [2])`. Could the new overload carry the column ordinal so the connector can choose the appropriate mapping or decline the pair? If the intended contract requires a fixed column position per bound function, could we make that requirement explicit before publishing the API? [Parameter extraction](https://github.com/apache/spark/blob/aa57d17f070f0747c246adfa961ab5932542f321/sql/catalyst/src/main/scala/org/apache/spark/sql/catal yst/expressions/TransformExpression.scala#L276) · [Public overload](https://github.com/apache/spark/blob/aa57d17f070f0747c246adfa961ab5932542f321/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/functions/ReducibleFunction.java#L115) · [Earlier layout discussion](https://github.com/apache/spark/pull/55885#discussion_r3377019609) **4. [P2] Add `Int.MinValue` to the width-4 versus width-6 join in the test connector.** The common width is `12`, so it passes the LCM overflow check. The overflow happens in the **stored partition key**. The width-4 side stores `-2147483648`, then rounds down to `-2147483652` at width 12, wrapping to `2147483644`. The width-6 side already wraps to `2147483644` on write, so its reducer rounds that positive value down to `2147483640`. The same ID ends up in different groups and loses its match. Could we include this ID in the existing join and make the fixture’s reducer account for the wrapped lowest bucket using the source width? [Fixture reducer](https://github.com/apache/spark/blob/aa57d17f070f0747c246adfa961ab5932542f321/sql/core/src/test/scala/org/apache/spark/sql/connector/catalog/functions/transformFunctions.scala#L769) · [Write path](https://github.com/apache/spark/blob/aa57d17f070f0747c246adfa961ab5932542f321/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/c atalog/InMemoryBaseTable.scala#L376) · [Existing join test](https://github.com/apache/spark/blob/aa57d17f070f0747c246adfa961ab5932542f321/sql/core/src/test/scala/org/apache/spark/sql/connector/KeyGroupedPartitioningSuite.scala#L8212) **5. [P3] Bring the PR description in line with the final agreement.** Could you update `@since 4.4.0` to `@since 4.5.0` and remove “of the same function” from the deprecated fallback description? The final dispatch offers that overload to any pair resolved from two V2 `bucket(n, col)` transforms, including functions with different canonical names. [PR description](https://github.com/apache/spark/pull/55885) · [Version annotation](https://github.com/apache/spark/blob/aa57d17f070f0747c246adfa961ab5932542f321/sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/functions/ReducibleFunction.java#L113) · [Fallback condition](https://github.com/apache/spark/blob/aa57d17f070f0747c246adfa961ab5932542f321/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/TransformExpression.scala#L405) The hosted build for `aa57d17` passed with 29 successful jobs and 4 skipped, including successful Catalyst, SQL DSv2, and SQL extended suites. The proposed regressions come from tracing the base and head source and checking the counterexample values. I used hosted CI for Spark test execution. [Build results](https://github.com/metanil/spark/actions/runs/44651287286) -- 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]
