Support Questions

Find answers, ask questions, and share your expertise

Problem refreshing materialized view

avatar
New Contributor

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
New Contributor

Hi

 

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

 

Cheers.

avatar
Guru