liukun4515 opened a new issue, #3031: URL: https://github.com/apache/arrow-datafusion/issues/3031
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.** Schema: ``` c1 decimal(18,) ``` select * from table where c1 = 20; select * from table where c1 in (12,2) We will get the sql plan like below ``` ..... .... cast(c1 as decimal(20,0), cast(20 as decimal(20,0) ``` The type of `20` or `12,2` is INT64 in the datafusion, the coerced data type of ` decimal(18,0) compare with int64` is decimal(20,0) according to the rule `get_comparison_common_decimal_type`. We need to optimize this point like [spark-issue](https://issues.apache.org/jira/browse/SPARK-24994), and it will reduce unnecessary cast/try_cast in many literal case. **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. -- 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-unsubscr...@arrow.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org