0

I have a partitioned view and I am trying to drop an existing partition from the view definition using hive CLI. However, when I try to drop a partition, it throws me the following error:

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. null

Here is my create statement for view:

CREATE or replace VIEW test_view (logrecordtype, datacenter, ts_date, gen_date)
PARTITIONED ON (ts_date, gen_date)
AS SELECT logrecordtype, datacenter, ts_date, gen_date from test_table1 where ts_date <= '20200720'
union all
select logrecordtype, datacenter, ts_date, gen_date from test_table2 where ts_date != '20200720';

The underlying tables test_table1, test_table2 are also partitioned by (ts_date, gen_date).

Drop partition command:

ALTER VIEW test_view DROP IF EXISTS PARTITION (ts_date = '20200720', gen_date = '2020072201')

I am able to add partitions and issue show partition on my view but drop partition fails.

My show partition command shows:

show partitions test_view;
ts_date=20200720/gen_date=2020072201
  • try `ALTER VIEW test_view DROP IF EXISTS PARTITON(ts_date='20200720'),PARTITION(gen_date='2020072201')` – Shenanigator Aug 13 '20 at 05:55
  • It didn't work. – Rishi Pathak Aug 13 '20 at 06:59
  • can you share the output of `show create table test_view`? – sathya Aug 13 '20 at 07:31
  • `CREATE VIEW test_view AS SELECT logrecordtype AS logrecordtype, datacenter AS datacenter, ts_date AS ts_date, gen_date AS gen_date FROM (SELECT test_table1.logrecordtype, test_table1.datacenter, test_table1.ts_date, test_table1.gen_date from schema.test_table1 where test_table1.ts_date <= '20200720' union all select test_table2.logrecordtype, test_table2.datacenter, test_table2.ts_date, test_table2.gen_date from schema.test_table2 where test_table2.ts_date != '20200720') test_view` is a ddl I got even after creating a view ++ – sathya Aug 13 '20 at 09:06
  • ++with `CREATE or replace VIEW test_view (logrecordtype, datacenter, ts_date, gen_date) PARTITIONED ON (ts_date, gen_date) ...`. please share your view ddls after creation. `show parititons test_view` also not retrieving any output for me in hdp hive. – sathya Aug 13 '20 at 09:09

0 Answers0