comphead commented on code in PR #6462:
URL: https://github.com/apache/arrow-datafusion/pull/6462#discussion_r1207000989
##########
datafusion/expr/src/built_in_function.rs:
##########
@@ -431,29 +452,21 @@ impl BuiltinScalarFunction {
impl fmt::Display for BuiltinScalarFunction {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- for (func_name, func) in NAME_TO_FUNCTION.iter() {
- if func == self {
- return write!(f, "{}", func_name);
- }
+ if let Some(func_name) = FUNCTION_TO_NAME.get(self) {
+ write!(f, "{}", func_name)
+ } else {
+ // Should not be reached
+ panic!("Internal error: {self:?} not in ALL_FUNCTIONS list");
Review Comment:
Everything is great and needed, one nit, do we need to panic?
--
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]