Open forsaken628 opened 2 weeks ago
It also appears that the ROLLUP() method cannot be combined with other GROUP BY columns to reduce the number of generated combinations. This is an example:
DROP TABLE IF EXISTS sales;
CREATE TABLE sales (
brand VARCHAR NOT NULL,
segment VARCHAR NOT NULL,
quantity INT NOT NULL
);
INSERT INTO sales (brand, segment, quantity)
VALUES
('ABC', 'Premium', 100),
('ABC', 'Basic', 200),
('XYZ', 'Premium', 100),
('XYZ', 'Basic', 300);
-- This Works
SELECT
brand,
segment,
SUM (quantity)
FROM
sales
GROUP BY
ROLLUP (brand, segment)
ORDER BY
brand,
segment;
-- This does not work
SELECT
brand,
segment,
SUM (quantity)
FROM
sales
GROUP BY
brand,
ROLLUP (segment)
ORDER BY
brand,
segment;
It returns the following error:
unexpected `segment`, expecting `SELECT`, `EXCEPT`, `INTERSECT`, `IGNORE_RESULT`, `LIMIT`, `OFFSET`, `FROM`, `UNION`, `ORDER`, `VALUES`, `(`, or `WITH`
The expected behavior is that the any number of GROUP BY columns can be specified prior to specifying the ROLLUP() columns in order to reduce the calculated columns.
If this is a separate issue from the one above I would be happy to create a new issue.
Search before asking
Version
9c2c3dd75ecd9e90bf950cf833d6659191996214
What's Wrong?
The outermost level of this query contains the predicate i_category = 'Books', but the result contains rows where i_category is null.
How to Reproduce?
run
tests/sqllogictests/scripts/prepare_tpcds_data.sh
to construct the datasetAre you willing to submit PR?