Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Problem refreshing materialized view

avatar
New Member

Hi,

 

I'm having trouble refreshing a materialized view as it doesn't update properly. I'm going to show an example.

 

Base table "test_table" with 2 rows:

 

 

create table test_table
as
select 1 as c
union
select 2 as c

 

 

 

Then I create a materialized view from "test_table":

 

 

create materialized view test_mv
as
select *
from test_table

 

 

 

If I query test_mv, it show 2 rows, it's ok. But if I truncate the original table, and then rebuild the materialized view, the query over the materialized view keeps showing 2 rows!

 

 

truncate table test_table;
alter materialized view test_mv rebuild;
select * from test_mv; -- <-- This query returns 2 rows!!

 

 

 

Any ideas on what's happening? I'm running hive version 3.1.0.3.1.0.0-78 

 

Thanks!

2 REPLIES 2

avatar
Visitor

Hi

 

I came across the same issue when we truncated tables. Hive version 3.1.0.3.1.4.0-315

 

Cheers.

avatar
Guru