bito-code-review[bot] commented on PR #43641:
URL: https://github.com/apache/superset/pull/43641#issuecomment-5449498692
<!-- Bito Reply -->
The flagged issue is correct. The current implementation in the diff uses a
set comprehension that calls `script.check_functions_present({func})` for every
function in `engine_disallowed`, which triggers redundant AST traversals.
To resolve this, you should compute the set of all functions present in the
script once and then find the intersection with the denylist. Assuming `script`
provides a way to get all present functions (e.g.,
`script.get_all_functions()`), the implementation would look like this:
```python
# Compute present functions once
present_functions = script.get_all_functions()
found = {func for func in engine_disallowed if func in
present_functions}
```
If `script.get_all_functions()` is not available, you should expose a method
that performs a single AST traversal to collect all function names, then
perform the intersection.
There are no other comments on this PR to address.
**superset/sql/execution/executor.py**
```
# Compute present functions once
present_functions = script.get_all_functions()
found = {func for func in engine_disallowed if func in
present_functions}
```
--
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]