SEPURI-SAI-KRISHNA commented on PR #60175:
URL: https://github.com/apache/spark/pull/60175#issuecomment-6737277991

   Thanks for the review. Pushed a commit that addresses it:
   
   - NULL integral offsets of a wider type no longer fail with `MatchError` and 
return the same rows as before (inline reply).
   - Equal frames with offsets of different integral types share one frame 
again (inline reply).
   - Non-integral offsets: the narrowing is the existing behavior, see the 
inline reply.
   - The Connect golden file `window.explain` is regenerated (CI failure in 
`ProtoToParsedPlanTestSuite`): the `INT` order of `rangeBetween(2L, 3L)` no 
longer casts its `BIGINT` offsets to `INT`.
   
   On the two questions:
   
   **Generated names of fitting offsets.** Yes, intended. An integral offset 
whose type is wider than the order type is no longer cast, whatever its value, 
so a `PRECEDING` offset is now named as written: `1 PRECEDING` on a `SMALLINT` 
column (an `INT` literal) instead of `(- 1) FOLLOWING`, and `CAST(1 AS BIGINT) 
PRECEDING` on an `INT` column instead of `(- CAST(1 AS BIGINT)) FOLLOWING`. 
These are the names such frames already have when the offset has the order type 
(`1 PRECEDING` on an `INT` column is named `1 PRECEDING` before and after this 
PR). `FOLLOWING` offsets and DataFrame `rangeBetween` frames keep their names; 
I compared all of these with Spark 4.0.3. Deciding by value would make the 
analyzed plan depend on the value of the literal. I updated the description to 
cover fitting offsets as well, and I can add a line to the SQL migration guide 
if committers prefer.
   
   **Cost of the comparison.** The value reader is now a projection of 
`CAST(key AS BIGINT)` read with `getLong(0)`, without the `Function1` and its 
boxing, and without the per-type match. A micro-benchmark of `compare` (2M 
comparisons on `INT` and `BIGINT` keys, after warming up all four integral 
types, best of 7): the new comparison takes 53.7 ms (`INT`) / 55.7 ms 
(`BIGINT`). The `RangeBoundOrdering` with an `Add` projection used before this 
PR takes 63.9 / 65.4 ms, and the `Function1` reader of the previous commit took 
69.8 / 77.8 ms.
   


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