zanmato1984 commented on issue #41336: URL: https://github.com/apache/arrow/issues/41336#issuecomment-3211227307
Interesting finding. I think using `LastType` for `case_when` output type resolution isn't the real issue. Because when doing exact match, it is reasonable to assume that all branches have the same type, thus assuming any of them to be the output should be fine. However an exception is for parametric types, they can be of the same type yet not exactly the same - differing on their type parameters (e.g., `decimal128(9, 7)` VS. `decimal128(3, 2)`). We used to be shorthand handling such cases, until #47297 introduced a way to suppress exact matching by using customized match constraints. So what we can do for `case_when` is: apply a constraint that requires all the branch decimals have the same `p` and `s`, so that cases in the issue description won't be an exact match. Then the matching naturally falls into `DispatchBest` and implicit casts will be applied. Let me try to do that in a PR. -- 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 For queries about this service, please contact Infrastructure at: us...@infra.apache.org