bito-code-review[bot] commented on PR #42927:
URL: https://github.com/apache/superset/pull/42927#issuecomment-5229436567
<!-- Bito Reply -->
The flagged issue is correct. The `_drop_unsupported_options` method in
`QueryObject` inspects the signature of post-processing operations to filter
out unsupported options. However, if an option named `df` is present in the
stored `options` dictionary, it is currently treated as a supported parameter
because it is not explicitly excluded, leading to a `TypeError` when the
operation is called as `operation(df, **options)` (since `df` is passed both as
the first positional argument and as a keyword argument).
To resolve this, you should explicitly exclude `df` from the `options`
dictionary in `_drop_unsupported_options`.
### Proposed Fix
In `superset/common/query_object.py`, update the filtering logic in
`_drop_unsupported_options`:
```python
options = post_proc.get("options") or {}
unsupported = {key for key in options if key not in parameters or
key == "df"}
if not unsupported:
return post_proc
```
This change ensures that even if `df` is present in the stored options, it
is filtered out before the operation is invoked.
Would you like me to check the rest of the comments on this PR to see if
there are other issues that need addressing?
**superset/common/query_object.py**
```
options = post_proc.get("options") or {}
unsupported = {key for key in options if key not in parameters or
key == "df"}
if not unsupported:
return post_proc
```
--
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]