Selecting same aggregation multiple times leads to incorrect results (regression in master?)
See original GitHub issueI created a table
CREATE TABLE IF NOT EXISTS fruit (
"orderdate" TEXT,
"name" TEXT,
"country" TEXT,
"count" int
)
CLUSTERED BY ("orderdate") INTO 2 SHARDS;
And then I inserted some data
insert into fruit(orderdate,name,country,count) values('2020-06-01','apple','usa',1);
insert into fruit(orderdate,name,country,count) values('2020-06-02','apple','zh',2);
insert into fruit(orderdate,name,country,count) values('2020-06-03','apple','ca',3);
insert into fruit(orderdate,name,country,count) values('2020-06-04','apple','tx',4);
insert into fruit(orderdate,name,country,count) values('2020-06-05','apple','yy',5);
insert into fruit(orderdate,name,country,count) values('2020-06-06','apple','cw',6);
execute sql:
SELECT
name,
count(country) AS counts
FROM
fruit
WHERE
orderdate >= '2020-06-02'
AND orderdate <= '2020-06-05'
GROUP BY
name
the result is count=4.
but I joined case when
SELECT
name,
count(country) AS counts,
CASE WHEN 1 = 0 THEN
0
ELSE
cast(count(country) AS double)
END AS usacount
FROM
fruit
WHERE
orderdate >= '2020-06-02'
AND orderdate <= '2020-06-05'
GROUP BY
name
the result is counts=6. what happened?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Steps to Take When Your Regression (or Other Statistical ...
Misspecifying the model The results look strange because they're not very accurate. There may exist effects you didn't include, like interactions, non-linear ...
Read more >Incorrect output is returned when you use the Linear ...
Discusses a problem in which the incorrect output is returned when you use Linear Regression (LINEST) function in Excel.
Read more >Practical Regression and Anova using R
The objective is to learn what methods are available and more importantly, when they should be applied.
Read more >What is Bagging? | IBM
Bagging, also known as bootstrap aggregation, is the ensemble learning method that is commonly used to reduce variance within a noisy dataset.
Read more >Multicollinearity in Regression Analysis: Problems, Detection ...
Multicollinearity is when independent variables in a regression model are correlated. I explore its problems, testing your model for it, and solutions.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should be fixed now with https://github.com/crate/crate/pull/10094
That’s great. Thank you very much.