Archita-kale opened a new pull request, #43694: URL: https://github.com/apache/superset/pull/43694
## Summary Follow-up fix for #43547 to preserve `NULL`/`NaN` grouping values through the pandas post-processing `pivot()` operator. ## Problem `NULL` values in the `columns` parameter were already handled using Superset's existing `NULL_STRING` before calling `pivot_table()`. However, `index` columns did not have equivalent handling. As a result, when a `NULL` grouping value survived the `aggregate` step, pandas `pivot_table()` could drop that row during pivoting because the grouping key contained `NaN`. This caused valid `NULL` groups to disappear from the pivot output. ## Solution - Fill `NULL`/`NaN` values in `index` columns with the existing `NULL_STRING` before calling `pivot_table()`. - Handle categorical `index` columns by adding `NULL_STRING` to their categories before filling. - Handle categorical `columns` values when the configured fill value is not already present in the categories. - Preserve the existing `drop_missing_columns` / `dropna` behavior. - Reuse the existing `NULL_STRING` constant. - Add regression tests covering NULL index values in flat and MultiIndex pivots, including categorical dtypes. ## Tests Added regression tests for: - Flat pivot with NULL index values - Pivot with NULL index values and columns grouping - Categorical index with NULL values - Categorical index and columns with NULL values Tested with: ```bash pytest tests/unit_tests/pandas_postprocessing/test_pivot.py -v @kokhlo I’ve submitted this follow-up PR for the NULL index handling issue identified in the discussion. The change preserves NULL grouping values through the pivot post-processing path and includes regression tests. Would appreciate your review! -- 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]
