dosubot[bot] commented on issue #23072:
URL: https://github.com/apache/superset/issues/23072#issuecomment-2971888600

   <!-- Answer -->
   The root cause here is the order of operations in Superset's post-processing 
pipeline: currently, rolling calculations are applied before resampling/filling 
missing values, which leads to technically incorrect results—rolling ignores 
the zeros or interpolated points that should be included if resampling happened 
first. This is why you see the "stepped" pattern instead of a smooth rolling 
mean, especially when your data has missing dates (like weekends) that should 
be filled with zeros before rolling is applied.
   
   The pipeline is defined as a list of operations (like "rolling", "resample") 
and executed in order, but the construction of this list isn't managed 
centrally—it's handled in chart-specific or serialization logic, and by 
default, the order is often wrong for this use case. Fixing this would require 
ensuring that resample/imputation always happens before rolling in the query 
pipeline for time series charts. See the relevant code and schema for more 
details on how these operations are defined and executed 
([source](https://github.com/apache/superset/blob/21d8d57380bcc67bab8e603fda99ffbc4a7dcac2/superset/common/query_object.py),
 
[source](https://github.com/apache/superset/blob/21d8d57380bcc67bab8e603fda99ffbc4a7dcac2/superset/charts/schemas.py)).
   
   As a workaround, if you have control over the dataset or can preprocess your 
data, you could fill missing dates with zeros before uploading to Superset, 
then apply the rolling mean. Otherwise, a code change is needed to adjust the 
post-processing order for the affected chart types.
   
   Let me know if you want more details on where to look in the code or how to 
approach a fix!
   
   
   <!-- 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/208b4033-5c43-4de9-a6f5-7ed35554ca80?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/208b4033-5c43-4de9-a6f5-7ed35554ca80?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/208b4033-5c43-4de9-a6f5-7ed35554ca80?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/208b4033-5c43-4de9-a6f5-7ed35554ca80?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/208b4033-5c43-4de9-a6f5-7ed35554ca80?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/208b4033-5c43-4de9-a6f5-7ed35554ca80?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/208b4033-5c43-4de9-a6f5-7ed35554ca80?feedback_type=other)</sup>&nbsp;&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[!
 [Share on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/23072)


-- 
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

Reply via email to