rdtr opened a new issue, #13597:
URL: https://github.com/apache/gluten/issues/13597

   ### Backend
   
   VL (Velox)
   
   ### Bug description
   
   **[Expected behavior]**
   
   Spark rewrites `try_add` / `try_subtract` on non-numeric operands to 
`TryEval(Add(left, right, EvalMode.ANSI))` and `TryEval(Subtract(...))` 
(`TryEval.scala:85` and `:199` on branch-4.2, `:84` and `:161` on branch-3.5). 
Interval addition always uses `IntervalMathUtils.addExact` 
(`arithmetic.scala:455-456` on branch-4.2), so `a + b` on two year-month 
intervals throws on overflow in both ANSI modes and `try_add(a, b)` returns 
NULL. Velox has the matching Spark functions since 
facebookincubator/velox#17098: `add` / `subtract` with `INTERVAL YEAR TO MONTH` 
arguments throw "Arithmetic overflow".
   
   **[Actual behavior]**
   
   Both forms fall back to vanilla Spark.
   
   ```sql
   SELECT try_add(a, b), try_subtract(a, b), a + b FROM t  -- a, b: INTERVAL 
YEAR TO MONTH
   ```
   
   - `VeloxSparkPlanExecApi.genTryArithmeticTransformer` accepts only integral 
types and throws `try is not supported` for anything else.
   - `ConverterUtils.getTypeSigName` has no case for `YearMonthIntervalType`, 
so any scalar function with a year-month interval argument fails with `Type 
YearMonthIntervalType(0,1) not supported.` This also blocks plain `a + b`.
   
   Day-time intervals have no Substrait type mapping in Gluten at all 
(`ConverterUtils.getTypeNode` only maps `YearMonthIntervalType.DEFAULT`), so 
they are out of scope here.
   
   
   ### Gluten version
   
   main branch
   
   ### Spark version
   
   Spark-3.5.x
   
   ### Spark configurations
   
   _No response_
   
   ### System information
   
   _No response_
   
   ### Relevant logs
   
   ```bash
   
   ```


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