1

I want to create a view on a hive table which is partitioned . My view definition is as below:

create view schema.V1 as select t1.* from scehma.tab1 as t1 inner join (select record_key ,max(last_update) as last_update from scehma.tab1 group by record_key) as  t2 on t1.record_key=t2.record_key and t1.last_update=t2.last_update 

My table of tab1 is partitioned on quarter_id.

When i run any query on the view it gives error:

FAILED: SemanticException [Error 10041]: No partition predicate found for Alias "V1:t2:tab1" Table "tab1"

Regards Jayanta Layak

Jared
  • 2,904
  • 6
  • 33
  • 37

1 Answers1

0

Your Hive settings must be set to execute jobs in Strict mode (Default in Hive 2.x). This prevents queries of partitioned tables without a WHERE clause that filters on partitions.

If you need to run a query across all partitions(full table scan) you can set the mode to 'nonstrict'. Use this property with care as it triggers enormous mapreduce jobs.

set hive.mapred.mode=nonstrict; 

If you don't need an entire table scan, you can simply specify the partition value in your query's WHERE clause.

ninja123
  • 200
  • 1
  • 10