bito-code-review[bot] commented on PR #44744:
URL: https://github.com/apache/superset/pull/44744#issuecomment-5864989986

   <!-- Bito Reply -->
   The flagged issue is correct. In 
`superset/mcp_service/chart/chart_helpers.py`, the `waterfall` query builder 
logic only extracts `x_axis` or `granularity_sqla` as a single column, failing 
to include the time grain information required for proper temporal aggregation. 
   
   To resolve this, you should update the `waterfall` logic to include the time 
grain if it is present in the form data. Here is the corrected implementation 
for that block:
   
   ```python
       if viz_type == "waterfall":
           axis = form_data.get("x_axis") or form_data.get("granularity_sqla")
           time_grain = form_data.get("time_grain_sqla")
           columns = list(axis) if isinstance(axis, list) else [axis] if axis 
else []
           if time_grain:
               columns.append(time_grain)
           columns.extend(form_data.get("groupby") or [])
           query = _build_single_query_dict(
               form_data, columns, metrics, row_limit=row_limit
           )
           query["orderby"] = [(column, True) for column in columns]
           return [query]
   ```
   
   Would you like me to fetch all other comments on this PR to validate and 
implement fixes for them as well?
   
   **superset/mcp_service/chart/chart_helpers.py**
   ```
   if viz_type == "waterfall":
           axis = form_data.get("x_axis") or form_data.get("granularity_sqla")
           time_grain = form_data.get("time_grain_sqla")
           columns = list(axis) if isinstance(axis, list) else [axis] if axis 
else []
           if time_grain:
               columns.append(time_grain)
           columns.extend(form_data.get("groupby") or [])
           query = _build_single_query_dict(
               form_data, columns, metrics, row_limit=row_limit
           )
           query["orderby"] = [(column, True) for column in columns]
           return [query]
   ```


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

Reply via email to