Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

unexpected error while adding partitions in hive partitioned view

avatar
Explorer

I am trying to create partitioned view on top of a hive partitioned table, but while executing alter view to add partition info in view hive is giving unexpected error with very brief & vague error message. Below is the ddl of partitioned table (a_part) & partitioned view (a_part_view) and info of partition present in table.
So when i am trying to add partition in view, it gives me below error, both properties (hive.mapred.mode & hive.exec.dynamic.partition.mode) are set to nonstrict.

CREATE TABLE a_part (col1 int, col2 string, col3 date) PARTITIONED BY (dt string) STORED AS ORC;CREATE VIEW a_part_view (col1, col2, col3, dt)
PARTITIONED ON (dt)
AS SELECT col1, col2, col3, dt FROM a_part;
0: jdbc:hive2://cdhdata2:10000/default> show partitions a_part;
+--------------+--+
|  partition   |
+--------------+--+
| dt=20160515  |
| dt=20160516  |
| dt=20160517  |
+--------------+--+

0: jdbc:hive2://cdhdata2:10000/default> ALTER VIEW a_part_view ADD PARTITION (dt='20160515');
Error: Error while compiling statement: FAILED: SemanticException [Error 10056]: The query does not reference any valid partition. To run this query, set hive.mapred.mode=nonstrict (state=42000,code=10056)

So am i missing or doing some thing wrong, It would be really helpful if somebody shed more light on this.

Stack info: CDH 5.5.2, Apache hive (Hive 1.1.0-cdh5.5.2), kerberos & sentry enabled.

p.s: drop partition command is working fine (although there isn't a partition to drop):

0: jdbc:hive2://cdhdata2:10000/default> ALTER VIEW a_part_view drop PARTITION (dt='20160515');
No rows affected (0.106 seconds)
1 ACCEPTED SOLUTION

avatar
Explorer

I was following backdated documentation, views doesn't have partitioned on clause and hive compiler take care of partition pruning on underlying table. 

View solution in original post

1 REPLY 1

avatar
Explorer

I was following backdated documentation, views doesn't have partitioned on clause and hive compiler take care of partition pruning on underlying table.