0
votes

How to discard/hide partition column from hive view while selecting , at the same time filter can apply using where clause from the view created on base table partition column, base table is a partitioned table?

For Ex: my table ddl is create table test(id int) partitioned by (year);

view DDL: create view myview select id,year from test;

Now I don't want to see the value of year while selecting the data from view at the same time I should be able to query on specific partition of the base table using myview.

1

1 Answers

0
votes

There is a concept of creating a partitioned view available now in HIVE. You should try exploring.

For example,

CREATE VIEW myview PARTITIONED ON (year) AS SELECT id, year FROM test;

Refer to the below link to understand the rules to be adhered for partition columns when written from the base tables. It seems still limited therefore to be used only if it fits your needs.

https://cwiki.apache.org/confluence/display/Hive/PartitionedViews