You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2020/03/25 06:40:04 UTC

[GitHub] [hive] kgyrtkirk commented on a change in pull request #960: HIVE-23030 ds rollup union

kgyrtkirk commented on a change in pull request #960: HIVE-23030 ds rollup union
URL: https://github.com/apache/hive/pull/960#discussion_r397635667
 
 

 ##########
 File path: ql/src/test/queries/clientpositive/sketches_rollup.q
 ##########
 @@ -0,0 +1,40 @@
+
+set hive.support.concurrency=true;
+set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
+set hive.strict.checks.cartesian.product=false;
+set hive.stats.fetch.column.stats=true;
+set hive.materializedview.rewriting=true;
+set hive.fetch.task.conversion=none;
+
+create table sketch_input (id int, category char(1))
+STORED AS ORC
+TBLPROPERTIES ('transactional'='true');
+
+insert into table sketch_input values
+  (1,'a'),(1, 'a'), (2, 'a'), (3, 'a'), (4, 'a'), (5, 'a'), (6, 'a'), (7, 'a'), (8, 'a'), (9, 'a'), (10, 'a'),
+  (6,'b'),(6, 'b'), (7, 'b'), (8, 'b'), (9, 'b'), (10, 'b'), (11, 'b'), (12, 'b'), (13, 'b'), (14, 'b'), (15, 'b')
+; 
+
+-- create an mv for the intermediate results
+create  materialized view mv_1 as
+  select category, ds_hll_sketch(id),count(id) from sketch_input group by category;
+
+-- see if we use the mv
+explain
+select category, ds_hll_estimate(ds_hll_sketch(id)) from sketch_input group by category;
+
+select category, ds_hll_estimate(ds_hll_sketch(id)) from sketch_input group by category;
+
+-- union sketches across categories and get overall unique count estimate
+explain
+select ds_hll_estimate(ds_hll_sketch(id)) from sketch_input group by category;
+select ds_hll_estimate(ds_hll_sketch(id)) from sketch_input group by category;
+
+-- see how well mv/count works
+explain
+select count(id) from sketch_input;
 
 Review comment:
   this was just a preliminary check that rollup works on mv-s (and I didn't mess up anything else)
   
   I have removed it

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org