<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Problem refreshing materialized view in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Problem-refreshing-materialized-view/m-p/316727#M226881</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble refreshing a materialized view as it doesn't update properly.&amp;nbsp;I'm going to show an example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Base table "test_table" with 2 rows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;create table test_table
as
select 1 as c
union
select 2 as c&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I create a materialized view from "test_table":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;create materialized view test_mv
as
select *
from test_table&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;truncate table test_table;
alter materialized view test_mv rebuild;
select * from test_mv; -- &amp;lt;-- This query returns 2 rows!!&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on what's happening? I'm running hive&amp;nbsp;version 3.1.0.3.1.0.0-78&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 19 May 2021 17:47:52 GMT</pubDate>
    <dc:creator>luigui</dc:creator>
    <dc:date>2021-05-19T17:47:52Z</dc:date>
    <item>
      <title>Problem refreshing materialized view</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Problem-refreshing-materialized-view/m-p/316727#M226881</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble refreshing a materialized view as it doesn't update properly.&amp;nbsp;I'm going to show an example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Base table "test_table" with 2 rows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;create table test_table
as
select 1 as c
union
select 2 as c&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I create a materialized view from "test_table":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;create materialized view test_mv
as
select *
from test_table&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;truncate table test_table;
alter materialized view test_mv rebuild;
select * from test_mv; -- &amp;lt;-- This query returns 2 rows!!&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on what's happening? I'm running hive&amp;nbsp;version 3.1.0.3.1.0.0-78&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 17:47:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Problem-refreshing-materialized-view/m-p/316727#M226881</guid>
      <dc:creator>luigui</dc:creator>
      <dc:date>2021-05-19T17:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: Problem refreshing materialized view</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Problem-refreshing-materialized-view/m-p/330976#M230791</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I came across the same issue when we truncated tables. Hive version 3.1.0.3.1.4.0-315&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 15:12:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Problem-refreshing-materialized-view/m-p/330976#M230791</guid>
      <dc:creator>MBohlmann</dc:creator>
      <dc:date>2021-11-24T15:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Problem refreshing materialized view</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Problem-refreshing-materialized-view/m-p/331078#M230813</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/88725"&gt;@luigui&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/90042"&gt;@MBohlmann&lt;/a&gt;&amp;nbsp; I believe you are hitting&amp;nbsp;&lt;A href="https://issues.apache.org/jira/browse/HIVE-22260" target="_blank"&gt;https://issues.apache.org/jira/browse/HIVE-22260&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2021 15:36:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Problem-refreshing-materialized-view/m-p/331078#M230813</guid>
      <dc:creator>asish</dc:creator>
      <dc:date>2021-11-25T15:36:55Z</dc:date>
    </item>
  </channel>
</rss>

