Skip to content

Commit

Permalink
Merge branch 'apache:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
omerfbolat authored Jan 10, 2024
2 parents ff02190 + ea4e9a6 commit 39e6181
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 21 deletions.
13 changes: 4 additions & 9 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6052,15 +6052,10 @@ flux@^4.0.1:
fbemitter "^3.0.0"
fbjs "^3.0.0"

follow-redirects@^1.0.0:
version "1.14.8"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.8.tgz#016996fb9a11a100566398b1c6839337d7bfa8fc"
integrity sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==

follow-redirects@^1.14.7:
version "1.14.9"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7"
integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==
follow-redirects@^1.0.0, follow-redirects@^1.14.7:
version "1.15.4"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.4.tgz#cdc7d308bf6493126b17ea2191ea0ccf3e535adf"
integrity sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==

fork-ts-checker-webpack-plugin@^6.5.0:
version "6.5.0"
Expand Down
12 changes: 6 additions & 6 deletions superset-embedded-sdk/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions superset-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions superset/utils/pandas_postprocessing/cum.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def cum(
"""
columns = columns or {}
df_cum = df.loc[:, columns.keys()]
df_cum = df_cum.fillna(0)
operation = "cum" + operator
if operation not in ALLOWLIST_CUMULATIVE_FUNCTIONS or not hasattr(
df_cum, operation
Expand Down
5 changes: 5 additions & 0 deletions tests/unit_tests/fixtures/dataframes.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@
data={"label": ["x", "y", "z", "q"], "y": [1.0, 2.0, 3.0, 4.0]},
)

timeseries_with_gap_df = DataFrame(
index=to_datetime(["2019-01-01", "2019-01-02", "2019-01-05", "2019-01-07"]),
data={"label": ["x", "y", "z", "q"], "y": [1.0, 2.0, None, 4.0]},
)

timeseries_df2 = DataFrame(
index=to_datetime(["2019-01-01", "2019-01-02", "2019-01-05", "2019-01-07"]),
data={
Expand Down
14 changes: 14 additions & 0 deletions tests/unit_tests/pandas_postprocessing/test_cum.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
multiple_metrics_df,
single_metric_df,
timeseries_df,
timeseries_with_gap_df,
)
from tests.unit_tests.pandas_postprocessing.utils import series_to_list

Expand Down Expand Up @@ -77,6 +78,19 @@ def test_cum():
)


def test_cum_with_gap():
# create new column (cumsum)
post_df = pp.cum(
df=timeseries_with_gap_df,
columns={"y": "y2"},
operator="sum",
)
assert post_df.columns.tolist() == ["label", "y", "y2"]
assert series_to_list(post_df["label"]) == ["x", "y", "z", "q"]
assert series_to_list(post_df["y"]) == [1.0, 2.0, None, 4.0]
assert series_to_list(post_df["y2"]) == [1.0, 3.0, 3.0, 7.0]


def test_cum_after_pivot_with_single_metric():
pivot_df = pp.pivot(
df=single_metric_df,
Expand Down

0 comments on commit 39e6181

Please sign in to comment.