dosubot[bot] commented on issue #34894: URL: https://github.com/apache/superset/issues/34894#issuecomment-3234908691
<!-- Greeting --> Hi @nikitasavelyev425! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team. <!-- Answer --> The intended behavior of `get_time_filter(remove_filter=True)` is to ensure the time filter is only applied inside your virtual dataset query and not again in the outer query, preventing double filtering and improving performance. This is confirmed in both the documentation and the codebase ([docs](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/docs/docs/configuration/sql-templating.mdx), [code](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/jinja_context.py)). However, there is a subtle propagation bug: if your virtual dataset uses nested macros or is composed using the `dataset()` macro, the "removal" state that tells Superset not to apply the filter again does not always propagate correctly. This can cause the time filter to be applied both in the inner and outer queries, as you observed. The issue is highly sensitive to how the dataset is structured—direct use of the macro works, but nesting or composition can break the removal logic ([code details](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/models/helpers.py)). To avoid double filtering, try to avoid nested dataset composition or ensure that all filter removal logic is handled at the top level of your virtual dataset. Until this propagation issue is fixed in Superset, this is the most reliable workaround. If you need more technical details or want to track the relevant code, see the implementation in `superset/jinja_context.py` and `superset/models/helpers.py`. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/cdbe7333-88bc-493b-a6c0-6b6c38a94f6b?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/cdbe7333-88bc-493b-a6c0-6b6c38a94f6b?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/cdbe7333-88bc-493b-a6c0-6b6c38a94f6b?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/cdbe7333-88bc-493b-a6c0-6b6c38a94f6b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/cdbe7333-88bc-493b-a6c0-6b6c38a94f6b?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/cdbe7333-88bc-493b-a6c0-6b6c38a94f6b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/cdbe7333-88bc-493b-a6c0-6b6c38a94f6b?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=githu b) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/34894) -- 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org