You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "2010YOUY01 (via GitHub)" <gi...@apache.org> on 2025/11/12 03:22:09 UTC
[I] Avoid check function type by matching names in the optimizer [datafusion]
2010YOUY01 opened a new issue, #18643:
URL: https://github.com/apache/datafusion/issues/18643
### Is your feature request related to a problem or challenge?
When implementing optimizer rules, it's common to check if a expression is certain function. Now it's commonly done through function name match check. A potential risk is: datafusion dependents might override the function implementation in the function registry, in such cases those optimizer rules should not be enabled, it's better to figure out a way to accurately check the function type.
I believe now they're done through name match because all function implementations live in a different crate than optimizer, and we don't want to add a crate dependency between them, so we can't do the trait object downcasting for type check.
One way I can think of is add a `source()` API in UDFs, so we can differentiate if this is builtin or added by the 3rd party, and in the optimizer we can check it safer like `fun.source() == BuiltIn && fun.name() == "min"`
Current optimizer examples for checking function type by name matching:
https://github.com/apache/datafusion/blob/0d52a1eebe403790a480ba404c2fe65b1aa1e897/datafusion/optimizer/src/single_distinct_to_groupby.rs#L90-L92
https://github.com/apache/datafusion/blob/0d52a1eebe403790a480ba404c2fe65b1aa1e897/datafusion/optimizer/src/analyzer/resolve_grouping_function.rs#L151-L153
https://github.com/apache/datafusion/blob/0d52a1eebe403790a480ba404c2fe65b1aa1e897/datafusion/optimizer/src/decorrelate.rs#L496
### Describe the solution you'd like
_No response_
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
--
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-unsubscribe@datafusion.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Avoid check function type by matching names in the optimizer [datafusion]
Posted by "aaryyya (via GitHub)" <gi...@apache.org>.
aaryyya commented on issue #18643:
URL: https://github.com/apache/datafusion/issues/18643#issuecomment-3548779488
take
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Avoid check function type by matching names in the optimizer [datafusion]
Posted by "GaneshPatil7517 (via GitHub)" <gi...@apache.org>.
GaneshPatil7517 commented on issue #18643:
URL: https://github.com/apache/datafusion/issues/18643#issuecomment-3738115619
hey @2010YOUY01 can you assign this...
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org