Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Create Temp Table for Show Locks

Highlighted

Create Temp Table for Show Locks

New Contributor

Hi Cloudera Community,

I'm trying to create a table or a view in hive for the function Show Locks. Is this possible? 

2 REPLIES 2
Highlighted

Re: Create Temp Table for Show Locks

Cloudera Employee

Hello @Kitboga123 

The creation of a table/view from a function is not possible. Creat table/view as statements only work against views/tables.

Re: Create Temp Table for Show Locks

Contributor

@Kitboga123  Hive Show locks command fetches the details from the table HIVE_LOCKS in hive DB.

 

mysql> desc HIVE_LOCKS;
+---------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+--------------+------+-----+---------+-------+
| HL_LOCK_EXT_ID | bigint(20) | NO | PRI | NULL | |
| HL_LOCK_INT_ID | bigint(20) | NO | PRI | NULL | |
| HL_TXNID | bigint(20) | NO | MUL | NULL | |
| HL_DB | varchar(128) | NO | | NULL | |
| HL_TABLE | varchar(128) | YES | | NULL | |
| HL_PARTITION | varchar(767) | YES | | NULL | |
| HL_LOCK_STATE | char(1) | NO | | NULL | |
| HL_LOCK_TYPE | char(1) | NO | | NULL | |
| HL_LAST_HEARTBEAT | bigint(20) | NO | | NULL | |
| HL_ACQUIRED_AT | bigint(20) | YES | | NULL | |
| HL_USER | varchar(128) | NO | | NULL | |
| HL_HOST | varchar(128) | NO | | NULL | |
| HL_HEARTBEAT_COUNT | int(11) | YES | | NULL | |
| HL_AGENT_INFO | varchar(128) | YES | | NULL | |
| HL_BLOCKEDBY_EXT_ID | bigint(20) | YES | | NULL | |
| HL_BLOCKEDBY_INT_ID | bigint(20) | YES | | NULL | |
+---------------------+--------------+------+-----+---------+-------+
16 rows in set (0.00 sec)

 

These are the available columns in the HIVE_LOCKS table, you can create the temp table according to your use case but the lot of dependency mappings have to designed and implemented.

Don't have an account?
Coming from Hortonworks? Activate your account here