1fanwang opened a new issue, #26639: URL: https://github.com/apache/datafusion/issues/26639
### Is your feature request related to a problem or challenge? NVL and IFNULL can choose a different result type from COALESCE for the same arguments. The compatibility-preserving fix in https://github.com/apache/datafusion/pull/25964 retains their existing rules for boolean, integer, float and string arguments while fixing decimal and temporal types. The [review discussion](https://github.com/apache/datafusion/pull/25964#discussion_r4327079953) reports that NVL(Int64, UInt64) chooses Float32, whereas COALESCE chooses Decimal128(20,0), and suggests using COALESCE's rules throughout. This issue tracks the behavior decision requested in https://github.com/apache/datafusion/pull/25964#discussion_r4331131776. ### Describe the solution you'd like Decide whether NVL and IFNULL should use COALESCE's common-type resolution for every argument pair. That would remove the separate coercion rule and avoid the reported wide-integer precision loss. The compatibility cost needs agreement first: existing calls such as IFNULL(int_col, false) currently plan with a string result, but COALESCE rejects that combination. If the behavior changes, document the affected combinations and migration in the upgrade guide, with regression coverage for both result types and values. ### Describe alternatives you've considered Keep the compatibility-preserving rules from https://github.com/apache/datafusion/pull/25964. This avoids rejecting existing queries but leaves two coercion paths to maintain. ### Additional context The current split is implemented in [NVLFunc::coerce_types](https://github.com/apache/datafusion/blob/71cff4f69eb72c38c81959864d7cd22a4aecf72a/datafusion/functions/src/core/nvl.rs#L162-L175). This is a follow-up discussion, not a request to broaden that PR or duplicate https://github.com/apache/datafusion/issues/25947. ### Willingness to contribute I would like to contribute to this feature, but request guidance from the DataFusion community. -- 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]
