Make type coercion rule more robust
Is your feature request related to a problem or challenge? Please describe what you are trying to do. Dask SQL project is seeing this:
Skipping optimizer rule TypeCoercion due to unexpected error: Error during planning: Coercion from [Timestamp(Nanosecond, Some("Europe/Berlin"))] to the signature Variadic([Int64]) failed.
Describe the solution you'd like It would be better for the rule to return the original expression rather than fail
Describe alternatives you've considered None
Additional context None
Also happens in common_sub_expression_eliminate:
Skipping optimizer rule common_sub_expression_eliminate due to unexpected error: Error during planning: 'Timestamp(Nanosecond, None) + Int64' can't be evaluated because there isn't a common type to coerce the types to
I think we can close this issue now that there are specific issues filed for optimizer rules that are failing, such as https://github.com/apache/arrow-datafusion/issues/3797, https://github.com/apache/arrow-datafusion/issues/3416, https://github.com/apache/arrow-datafusion/issues/3417, and https://github.com/apache/arrow-datafusion/issues/3418.