-
Hello, I think there might be something wrong with the SUM() function in QLever. Correct output: 1.106.581.000.000 For reference, the query takes the three largest Big Tech companies (according to the most recent number of their employees), then takes the most recent entry for their total revenue and sums it up. Is there something one can do to get the correct value using QLever? Best regards |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 2 replies
-
Hi Christina, There is currently nothing that you can change to make this query work correctly, but it should be a rather quick fix for me. |
Beta Was this translation helpful? Give feedback.
-
The problem is that the |
Beta Was this translation helpful? Give feedback.
-
Thank you both! Yes, it is apparently also adding the latest total revenue value for Meta Platforms. |
Beta Was this translation helpful? Give feedback.
-
I have written a fix that seems to solve the problem. It is not yet merged into QLever, but already runs on the Wikidata instance. |
Beta Was this translation helpful? Give feedback.
-
Hello Johannes, I just re-made this query (using templates, so different syntax): "Combined total revenue of the top 3 big tech companies (when ordered by descending number of employees)" In QLever, the LIMIT is ignored again: QLever, with sum I checked by hand that the following is correct: Wikidata Query Service outputs the expected values: This is one curiosity I found. The other is that the links in my original post still work regarding the LIMIT in the subquery. However, for some reason, they do not use the most recent total revenue values. For Microsoft, a newer, higher value from 2023 is now available. Just wanted to point it out. It's late so I might have made a mistake somewhere. Best, |
Beta Was this translation helpful? Give feedback.
-
Can you reproduce this with a smaller example? It's kind of hard to say where the mistake lies for such a monster query. If it's really a bug in QLever, there should be a smaller query reproducing it. |
Beta Was this translation helpful? Give feedback.
-
Great, thanks, here is an even simpler (and indeed minimal) example. When the second SELECT is commented out (lines 3 and 5), the query has three results as it should, otherwise it has many more.
|
Beta Was this translation helpful? Give feedback.
Hi Christina,
Thanks for your report.
The problem is not the
SUM
function, but theLIMIT
is ignored in the Subquery (The reported sum does not change if you remove the LIMIT.There is currently nothing that you can change to make this query work correctly, but it should be a rather quick fix for me.