Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Cumulative Sum Calculation in Metabase v0.50 #47613

Closed
ceereme opened this issue Sep 4, 2024 · 2 comments · Fixed by #47875
Closed

Bug in Cumulative Sum Calculation in Metabase v0.50 #47613

ceereme opened this issue Sep 4, 2024 · 2 comments · Fixed by #47875
Assignees
Labels
Priority:P1 Security holes w/o exploit, crashing, setup/upgrade, login, broken common features, correctness Querying/GUI Query builder catch-all, including simple mode .Regression Bugs that were previously fixed and/or bugs unintentionally shipped with new features. .Team/Querying Type:Bug Product defects
Milestone

Comments

@ceereme
Copy link

ceereme commented Sep 4, 2024

Describe the bug

I've encountered a bug with the cumulative sum calculation in Metabase version 0.50.xx that didn't exist in version 0.48 (I use 0.50.18 version)

In version 0.48, creating a cumulative sum of quantities sorted by categories worked correctly. However, in version 0.50, the cumulative sum does not sort properly

i have post this in discourse :
https://discourse.metabase.com/t/bug-in-cumulative-sum-calculation-in-metabase-v0-50/144567/10

To Reproduce

image

herebelow is SQL code autogenerate by metabase 0.50.17

SELECT
"source"."Products__CATEGORY" AS "Products__CATEGORY",
SUM("source"."QUANTITY") AS "sum",
SUM(SUM("source"."QUANTITY")) OVER (

ORDER BY
"source"."Products__CATEGORY" ASC ROWS UNBOUNDED PRECEDING
) AS "sum_2"
FROM
(
SELECT
"Products"."CATEGORY" AS "Products__CATEGORY",
"PUBLIC"."ORDERS"."QUANTITY" AS "QUANTITY"
FROM
"PUBLIC"."ORDERS"

LEFT JOIN "PUBLIC"."PRODUCTS" AS "Products" ON "PUBLIC"."ORDERS"."PRODUCT_ID" = "Products"."ID"
) AS "source"
GROUP BY
"source"."Products__CATEGORY"
ORDER BY
"sum" DESC,
"source"."Products__CATEGORY" ASC

this is the screenshot
image

Expected behavior

Expected result: The cumulative sum should start with the value 18.920 as the first row (corresponding to the sum quantity column), but the result was started with 69540

as comparation, using the same steps in producing the cumulative with 0.48 herebelow SQL code autogenerate by metabase 0.48

SELECT
"Products"."CATEGORY" AS "Products__CATEGORY",
SUM("PUBLIC"."ORDERS"."QUANTITY") AS "sum",
SUM("PUBLIC"."ORDERS"."QUANTITY") AS "sum_2"
FROM
"PUBLIC"."ORDERS"

LEFT JOIN "PUBLIC"."PRODUCTS" AS "Products" ON "PUBLIC"."ORDERS"."PRODUCT_ID" = "Products"."ID"
GROUP BY
"Products"."CATEGORY"
ORDER BY
"sum" DESC,
"Products"."CATEGORY" ASC

screenshot :
https://discourse.metabase.com/uploads/default/original/3X/9/c/9cbd5b5440140011a7317830e71217625f93a0c4.png

the result is correct.
you can see the difference.
I think this is big issue that make metabase don't have ability to make pareto diagram anymore. Which is common in analytic jobs

Logs

No response

Information about your Metabase installation

Metabase Version 0.50.18 
Server in our own Using Ubuntu 20.04 Server LTS, and the database is MariaDB 10.1x

Severity

I think this is substantial problem, Urgent to resolve

Additional context

No response

@ceereme ceereme added .Needs Triage Type:Bug Product defects labels Sep 4, 2024
@WiNloSt WiNloSt added Priority:P2 Average run of the mill bug Querying/GUI Query builder catch-all, including simple mode .Team/Querying .Regression Bugs that were previously fixed and/or bugs unintentionally shipped with new features. and removed .Needs Triage labels Sep 4, 2024
@cbeauch
Copy link

cbeauch commented Sep 5, 2024

We're having a different SUM issue since updating.

Partitioning by expressions of type FLOAT64 is not allowed at [13:5]

SUM(SUM(source.amount)) OVER (
PARTITION BY source.dateCreated,
source.reserve_event_type,
source.reserve_event_status,
source.amount,
source.notes,
source.reserve_event_id

This occured after we updated to 0.50 for a bunch of questions. Unsure if the questions themselves were changed during the update or if something else is going on but I know the table did not change.

@mngr mngr added Priority:P1 Security holes w/o exploit, crashing, setup/upgrade, login, broken common features, correctness and removed Priority:P2 Average run of the mill bug labels Sep 10, 2024
@github-actions github-actions bot added this to the 0.50.26 milestone Sep 16, 2024
@ceereme
Copy link
Author

ceereme commented Sep 18, 2024

Thank you very much to the entire Metabase team for resolving this bug. I look forward to the updated version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:P1 Security holes w/o exploit, crashing, setup/upgrade, login, broken common features, correctness Querying/GUI Query builder catch-all, including simple mode .Regression Bugs that were previously fixed and/or bugs unintentionally shipped with new features. .Team/Querying Type:Bug Product defects
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants