Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Hive Materialized View

Highlighted

Hive Materialized View

New Contributor

Hello,

I created a materialized view in Hive 3.0.0.3.0 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:

ALTER MATERIALIZED VIEW test_materializedvw REBUILD;

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$LocalHook.run(ReExecutionOverlayPlugin.java:45)
	at org.apache.hadoop.hive.ql.HookRunner.invokeGeneralHook(HookRunner.java:296)
	at org.apache.hadoop.hive.ql.HookRunner.runFailureHooks(HookRunner.java:283)
	at org.apache.hadoop.hive.ql.Driver.invokeFailureHooks(Driver.java:2620)

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.