6
votes

I have a question on Hive Views Partitions.

I have a base table which is partitioned on a Date Field. My View is a simple view which does a select * from the base table.

My Question is would the view be Partition aware when a view is queried y the end user? or do i need to execute any other commands to be able to use the partitions by view?

I am having this question because of the following statement in wiki.apache.org https://cwiki.apache.org/confluence/display/Hive/PartitionedView on this topic which mentioned:

1.One possible approach mentioned in HIVE-1079 is to infer view partitions automatically based on the partitions of the underlying tables. A command such as SHOW PARTITIONS could then synthesize virtual partition descriptors on the fly. This is fairly easy to do for use case #1, but potentially very difficult for use cases #2 and #3. So for now, we are punting on this approach.

Regards, Nish

1

1 Answers

2
votes

At my prior engagement we used views extensively and all of our tables were partitioned. We relied on the ability of the hive query planner to perform proper partition pruning in these views and it did so successfully. In fact there were several edge cases/complicated scenarios that required updates to the hive source code by Hortonworks. But in the general/simpler cases the partition pruning was working.