jackylee-ch commented on PR #10196:
URL: https://github.com/apache/paimon/pull/10196#issuecomment-5954753545

   Fixed in 5a40eb65c. The decimal branch no longer casts to `LongType` (which 
raises `CAST_OVERFLOW` under ANSI — Spark 4's default — for values outside the 
BIGINT range and aborts the compact). It now encodes the unscaled value as a 
fixed-width, sign-flipped two's-complement key, the same scheme the core 
`ZIndexer` uses, so the full decimal domain is covered at order-preserving 
resolution.
   
   Verified locally in `SparkZOrderUDFTest` (4 passed): updated the 
DECIMAL(10,2) case and added a DECIMAL(38,2) case with 
`spark.sql.ansi.enabled=true` and values just past both Long.MAX and Long.MIN, 
asserting the z-value is strictly increasing with the decimal. Reverting to the 
long cast makes that case fail with `[CAST_OVERFLOW] ... cannot be cast to 
"BIGINT"` — your exact repro. spotless and `git diff --check` clean. The 
procedure-level (`CALL compact ... zorder`) smoke runs in CI.
   


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

Reply via email to