Dataset:
Group by
CREATE TABLE selectdemo.users_groupby ( name varchar, gender varchar, email varchar, age int, bool boolean, phrase varchar, PRIMARY KEY ((name, gender), email, age)) WITH comment='Users table GROUP BY SPECIAL EDITION :d';
INSERT INTO selectdemo.users_groupby (name, gender, email, age, bool, phrase) VALUES ('name_0', 'male', '[email protected]', 10, true, '');
INSERT INTO selectdemo.users_groupby (name, gender, email, age, bool, phrase) VALUES ('name_1', 'female', '[email protected]', 11, true, '');
INSERT INTO selectdemo.users_groupby (name, gender, email, age, bool, phrase) VALUES ('name_2', 'male', '[email protected]', 12, true, '');
INSERT INTO selectdemo.users_groupby (name, gender, email, age, bool, phrase) VALUES ('name_3', 'female', '[email protected]', 13, true, '');
INSERT INTO selectdemo.users_groupby (name, gender, email, age, bool, phrase) VALUES ('name_4', 'male', '[email protected]', 14, true, '');
INSERT INTO selectdemo.users_groupby (name, gender, email, age, bool, phrase) VALUES ('name_5', 'female', '[email protected]', 15, false, '');
INSERT INTO selectdemo.users_groupby (name, gender, email, age, bool, phrase) VALUES ('name_6', 'male', '[email protected]', 16, false, '');
INSERT INTO selectdemo.users_groupby (name, gender, email, age, bool, phrase) VALUES ('name_7', 'female', '[email protected]', 17, false, '');
INSERT INTO selectdemo.users_groupby (name, gender, email, age, bool, phrase) VALUES ('name_8', 'male', '[email protected]', 18, false, '');
INSERT INTO selectdemo.users_groupby (name, gender, email, age, bool, phrase) VALUES ('name_9', 'male', '[email protected]', 19, false, '');
Test query:
SELECT gender, sum(age) FROM selectdemo.users GROUP BY bool
Test result:
2014-06-18 17:05:41 DEBUG SelectTests:970 - ResultSet Meta
2014-06-18 17:05:41 DEBUG SelectTests:971 -
| gender| SUM(age)|
| male | 89 |
| female | 56 |
2014-06-18 17:05:41 DEBUG SelectTests:972 - ResultSet Expected
2014-06-18 17:05:41 DEBUG SelectTests:973 -
| gender| SUM(age)|
| male | 89 |
| female | 56 |
ResultSet - ColumnMetadata ResultSet Meta - size 10 -> name, gender, email... (all fields)
ExpectedResultSet - ColumnMetadata ResultSet Meta - size 2 -> gender, sum(age)