[
https://issues.apache.org/jira/browse/HIVE-22260?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jesus Camacho Rodriguez updated HIVE-22260:
-------------------------------------------
Component/s: Materialized views
> Materialized view rewriting does not support `UNION` operator, exact match
> can work under view
> ----------------------------------------------------------------------------------------------
>
> Key: HIVE-22260
> URL: https://issues.apache.org/jira/browse/HIVE-22260
> Project: Hive
> Issue Type: Sub-task
> Components: CBO, Materialized views
> Affects Versions: 3.1.2
> Reporter: Steve Carlin
> Priority: Major
> Attachments: complex0.sql
>
>
> In this case, a view can be created that hides some nastier syntax like a
> "union".
> A materialized view can contain the view with a simple query. So if the end
> query just uses the view, it should rewrite to the materialized view.
> Furthermore, an exception is thrown when it contains the "union" while
> creating the view. At a minimum, we should print a friendlier message when
> the rewrite fails.
> A script is attached.
> An example of this:
> create view logical_complex0 as
> with t as
> (select c1 as a, c2 as b from tab1 where c2 in (select f from logical_simple
> where g > 0)
> union
> select tab3.c1 as c, tab4.c2 as d from tab3, tab4 where tab3.c2 = tab4.c2)
> select a, b
> from t;
>
> – query separator
>
> create materialized view aview_complex0 stored as orc as
> select a as x, b as y, count(*)
> from logical_complex0
> group by 1, 2;
--
This message was sent by Atlassian Jira
(v8.3.4#803005)