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

planner: import more expand test. #54962

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions tests/integrationtest/r/executor/expand.result
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,45 @@ Computer:2 2 1350.0000
Phone:3 2 10.0000
TV:1 2 133.3333
TV:2 2 100.0000
SET @saved_sql_mode = @@session.sql_mode;
SET SESSION sql_mode= '';

SELECT UPPER(product) AS prod,
SUM(profit)/COUNT(*)
FROM t1 GROUP BY prod WITH ROLLUP HAVING prod='COMPUTER' ;
prod SUM(profit)/COUNT(*)
COMPUTER 1380.0000
SET SESSION sql_mode= @saved_sql_mode;

# Joins
SELECT product, country , year, SUM(profit) FROM t1,t2 WHERE
t1.country_id=t2.country_id GROUP BY product, country, year WITH ROLLUP;
product country year SUM(profit)
NULL NULL NULL 7785
Calculator NULL NULL 275
Calculator India NULL 150
Calculator India 2000 150
Calculator USA NULL 125
Calculator USA 1999 50
Calculator USA 2000 75
Computer NULL NULL 6900
Computer India NULL 2700
Computer India 2000 2700
Computer USA NULL 4200
Computer USA 1999 2700
Computer USA 2000 1500
Phone NULL NULL 10
Phone Finland NULL 10
Phone Finland 2003 10
TV NULL NULL 600
TV India NULL 200
TV India 2000 200
TV USA NULL 400
TV USA 1999 250
TV USA 2000 150

SELECT product, `SUM` FROM (SELECT product, SUM(profit) AS 'sum' FROM t1
GROUP BY product WITH ROLLUP) AS tmp
WHERE product is null;
product SUM
NULL 7785
21 changes: 21 additions & 0 deletions tests/integrationtest/t/executor/expand.test
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,24 @@ GROUP BY prod WITH ROLLUP;
--sorted_result
SELECT CONCAT(product,':',country_id), 1+1, SUM(profit)/COUNT(*) FROM t1
GROUP BY CONCAT(product,':',country_id) WITH ROLLUP;

SET @saved_sql_mode = @@session.sql_mode;
SET SESSION sql_mode= '';
--echo
--sorted_result
SELECT UPPER(product) AS prod,
SUM(profit)/COUNT(*)
FROM t1 GROUP BY prod WITH ROLLUP HAVING prod='COMPUTER' ;
SET SESSION sql_mode= @saved_sql_mode;

--echo
--echo # Joins
--sorted_result
SELECT product, country , year, SUM(profit) FROM t1,t2 WHERE
t1.country_id=t2.country_id GROUP BY product, country, year WITH ROLLUP;

--echo
--sorted_result
SELECT product, `SUM` FROM (SELECT product, SUM(profit) AS 'sum' FROM t1
GROUP BY product WITH ROLLUP) AS tmp
WHERE product is null;