sunchao commented on code in PR #7832:
URL: https://github.com/apache/datafusion-comet/pull/7832#discussion_r4778522379
##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -292,6 +292,18 @@ object QueryPlanSerde extends Logging with CometExprShim
with CometTypeShim {
classOf[DateFromUnixDate] -> CometDateFromUnixDate,
classOf[Days] -> CometDays,
classOf[DivideDTInterval] -> CometDivideDTInterval,
+ classOf[ExtractANSIIntervalDays] -> CometExtractANSIIntervalDays,
Review Comment:
Registering `ExtractANSIIntervalDays` lets this projection run in Comet,
where `date_add` evaluates the dispatched cast for the whole batch. Spark skips
it when `d` is NULL. I reproduced `CAST_OVERFLOW` on this PR with Spark 4.1.3
and ANSI enabled. Spark returns NULL for the first row and January 2 for the
second.
```sql
CREATE TABLE t(d DATE, n INT) USING parquet;
INSERT INTO t VALUES (NULL, 106751992), (DATE '2024-01-01', 1);
SELECT d + CAST(n AS INTERVAL DAY) FROM t;
```
Could we wrap `super.convert(expr, inputs, binding)` in
`withNullShortCircuit(expr, ...)` in `CometDateAdd` and test `+` and `-` in
separate projections? I tried that locally. Both cases and the existing fixture
passed. The distinction matters because when both signs appear in one
projection, Spark shares the extractor and raises the overflow. The guard
preserved that behavior too.
--
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]