deniskuzZ commented on code in PR #6988: URL: https://github.com/apache/hive/pull/6988#discussion_r4753384616
########## ql/src/test/queries/clientpositive/aggregate_join_transpose_unique.q: ########## @@ -0,0 +1,20 @@ +-- SORT_QUERY_RESULTS + +create table ajt_dim (x int, k int, y int, primary key (k) disable novalidate rely); +create table ajt_dim_nopk (k int, x int); +create table ajt_fact (fk int); +insert into ajt_dim values (10, 1, 100), (20, 2, 200), (null, 3, 300); +insert into ajt_dim_nopk values (1, 10), (2, 20), (3, null); +insert into ajt_fact values (1), (1), (2), (3), (3), (3); + +explain cbo +select k, sum(x), min(x), max(x), count(x), count(*) from ajt_dim join ajt_fact on k = fk group by k; +select k, sum(x), min(x), max(x), count(x), count(*) from ajt_dim join ajt_fact on k = fk group by k; + +explain cbo +select k, y, sum(x), sum(y) from ajt_dim join ajt_fact on k = fk group by k, y; +select k, y, sum(x), sum(y) from ajt_dim join ajt_fact on k = fk group by k, y; + +explain cbo +select d.k, sum(d.x) from (select k, max(x) x from ajt_dim_nopk group by k) d join ajt_fact on d.k = fk group by d.k; +select d.k, sum(d.x) from (select k, max(x) x from ajt_dim_nopk group by k) d join ajt_fact on d.k = fk group by d.k; Review Comment: **Optional**: could we re-run the selects with the rule disabled, as in #6838? With the defaults (`hive.transpose.aggr.join=false`), unique=false turns this rule off entirely. The .q.out then shows the untransposed results next to the transposed ones, so a regenerated golden file can't quietly accept wrong results. ```` set hive.transpose.aggr.join.unique=false; select k, sum(x), min(x), max(x), count(x), count(*) from ajt_dim join ajt_fact on k = fk group by k; select k, y, sum(x), sum(y) from ajt_dim join ajt_fact on k = fk group by k, y; select d.k, sum(d.x) from (select k, max(x) x from ajt_dim_nopk group by k) d join ajt_fact on d.k = fk group by d.k; ```` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
