[ https://issues.apache.org/jira/browse/HIVE-23368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17099641#comment-17099641 ]
Zoltan Haindrich commented on HIVE-23368: ----------------------------------------- [~jcamachorodriguez] I've just thinked about fixing this - but then I realized that it shouldn't even work "the best" with the rewrite: if we have rewrites enabled: {{count(distinct id)}} is rewritten to {{ds_hll_esitamte(ds_hll_sketch(id))}} which is from the MV point of view just like an int as {{count(distinct id)}} - so right now MV createrors should be aware if they want to create a sketch to be used by the rewrite. If we want to automatically do a partial rewrite (save the binary instead of a plain int) - then we will most probably have a rule which changes the rowtype of a relnode; which might be problematic. So right now I think it is safe to use MVs with datasketches rewrite. At the time I was writing the qtest I've created the view storing a `ds_hll_sketch` of the input data; to enable rollups: https://github.com/apache/hive/blob/5a119b9b556e1bfb0d7fdfcae2b5161b34d83f55/ql/src/test/queries/clientpositive/sketches_materialized_view_rollup2.q#L15 > MV rebuild should produce the same view as the one configured at creation time > ------------------------------------------------------------------------------ > > Key: HIVE-23368 > URL: https://issues.apache.org/jira/browse/HIVE-23368 > Project: Hive > Issue Type: Sub-task > Reporter: Zoltan Haindrich > Assignee: Zoltan Haindrich > Priority: Major > > There might be some configrations which might affect the rel-tree of the > materialized views. > In case rewrites to use datasketches for count(distinct) is enabled; the view > should store sketches instead of distinct values -- This message was sent by Atlassian Jira (v8.3.4#803005)