You can not execute the show partitions command inside the query instead of doing this you can run distinct query on partition column and use this query as nested query like shown below.
I have a table t2
which is partition on column roll
show partitions t2;
OK
roll=2
roll=3
to show partition and table name together you can refer below approach
select "t2",a.part
from
(
select distinct roll as part from t2
) a ;
Total MapReduce CPU Time Spent: 2 seconds 940 msec
OK
t2 2
t2 3
To be more specific result
> select "t2",concat("roll=",a.part)
> from
> (
> select distinct roll as part from t2
> ) a ;
Total MapReduce CPU Time Spent: 3 seconds 290 msec
OK
t2 roll=2
t2 roll=3