You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "andygrove (via GitHub)" <gi...@apache.org> on 2026/01/29 22:04:20 UTC

[I] Native engine crashes on literal DateTrunc and TimestampTrunc [datafusion-comet]

andygrove opened a new issue, #3342:
URL: https://github.com/apache/datafusion-comet/issues/3342

   ## Description
   
   When Spark's `ConstantFolding` optimizer rule is disabled, all-literal `trunc()` and `date_trunc()` calls reach the native engine, which crashes with:
   
   - `Invalid input to function DateTrunc. Expected (PrimitiveArray<Date32>, Scalar) or (PrimitiveArray<Date32>, StringArray)`
   - `Invalid input to function TimestampTrunc. Expected (PrimitiveArray<TimestampMicrosecondType>, Scalar, String) or (PrimitiveArray<TimestampMicrosecondType>, StringArray, String)`
   
   The native functions expect at least one array input but receive all scalars.
   
   ## How to Reproduce
   
   ```sql
   SET spark.sql.optimizer.excludedRules=org.apache.spark.sql.catalyst.optimizer.ConstantFolding;
   SELECT trunc(date('2024-06-15'), 'year');
   SELECT date_trunc('year', timestamp('2024-06-15 10:30:45'));
   ```
   
   ## Expected Behavior
   
   The native engine should handle scalar inputs gracefully — either by computing the correct result or by falling back to Spark.
   
   ## Affected Expressions
   
   - `trunc()` (DateTrunc)
   - `date_trunc()` (TimestampTrunc)


-- 
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: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Native engine crashes on literal DateTrunc and TimestampTrunc [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove closed issue #3342: Native engine crashes on literal DateTrunc and TimestampTrunc
URL: https://github.com/apache/datafusion-comet/issues/3342


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Native engine crashes on literal DateTrunc and TimestampTrunc [datafusion-comet]

Posted by "0lai0 (via GitHub)" <gi...@apache.org>.
0lai0 commented on issue #3342:
URL: https://github.com/apache/datafusion-comet/issues/3342#issuecomment-3982284193

   take


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org