Support Questions
Find answers, ask questions, and share your expertise

Hive Materialized View

Hive Materialized View

New Contributor


I created a materialized view in Hive using this kind of statement:

create materialized view test_materializedvw tblproperties('hive.materializedview.rewriting.time.window'='3min') as select ......

The view was created correctly and the queries execute fast. However, whenever the table which was used in the select statement of the view have new records, these new records are not being automatically updated in the materialized view (even after a long time)

I tried to set also this property hive.materializedview.rewriting.time.window=3min in hive-site.xml but it doesn't work.

On the other hand, if I try to update the view issuing the command:


I get the following error:

	java.sql.SQLException: Error while processing statement: FAILED: Hive Internal Error: org.apache.hadoop.hive.ql.metadata.HiveException(Error while invoking FailureHook. hooks: java.lang.NullPointerException
	at org.apache.hadoop.hive.ql.reexec.ReExecutionOverlayPlugin$
	at org.apache.hadoop.hive.ql.HookRunner.invokeGeneralHook(
	at org.apache.hadoop.hive.ql.HookRunner.runFailureHooks(
	at org.apache.hadoop.hive.ql.Driver.invokeFailureHooks(

Surprising enough, despite the error, if I perform a select on the view afterwards, I can see that the view data is now updated.

Is there anything wrong with the statement I'm using to create the materialized view. Can you please provide some help?

Many thanks.