0
votes

I have a internal hive table that is partitioned. I am creating a view on the hive table like this:

create view feat_view PARTITIONED ON(partition_dt) AS SELECT col1, partition_dt from features_v2;

This works fine. But when I try listing the partitions on the view, I get an empty result:

show partitions feat_view;;
+------------+--+
| partition  |
+------------+--+
+------------+--+

The base table is partitioned:

show partitions features_v2;;
+--------------------------+--+
|        partition         |
+--------------------------+--+
| partition_dt=2018-11-17  |
+--------------------------+--+

Is this intended to work? Can I list the partitions on a view just the way I would on a base table?

1

1 Answers

0
votes

From the Apache docs, showing view partitions doesn't seem to be supported. You can show partitions of materialized views (Hive 3). See the example at the end of Create and use a partitioned materialized view:

CREATE MATERIALIZED VIEW partition_mv_3 PARTITIONED ON (deptno) AS
SELECT emps.hire_date, emps.deptno FROM emps, emps2
  WHERE emps.deptno = emps2.deptno
  AND emps.deptno > 100 AND emps.deptno < 200;

SHOW PARTITIONS partition_mv_3;
+-------------+
|  partition  |
+-------------+
| deptno=101  |
+-------------+