[Hive - LanguageManual] Create/Drop/Grant/Revoke Roles and Privileges / Show Use
Create/Drop/Grant/Revoke Roles and Privileges
Hive Default Authorization - Legacy Mode has information about these DDL statements:
- CREATE ROLE
- GRANT ROLE
- REVOKE ROLE
- GRANT privilege_type
- REVOKE privilege_type
- DROP ROLE
- SHOW ROLE GRANT
- SHOW GRANT
For SQL standard based authorizationin Hive 0.13.0 and later releases, see these DDL statements:
- Role Management Commands
- Object Privilege Commands
Show
These statements provide a way to query the Hive metastore for existing data and metadata accessible to this Hive system.
Show Databases
SHOW (DATABASES|SCHEMAS) [LIKE identifier_with_wildcards]; |
SHOW DATABASES or SHOW SCHEMAS lists all of the databases defined in the metastore. The uses of SCHEMAS and DATABASES are interchangeable – they mean the same thing.
The optional LIKE clause allows the list of databases to be filtered using a regular expression. Wildcards in the regular expression can only be '*' for any character(s) or '|' for a choice. Examples are 'employees', 'emp*', 'emp*|*ees', all of which will match the database named 'employees'.
Show Tables/Partitions/Indexes
Show Tables
SHOW TABLES [IN database_name] [identifier_with_wildcards]; |
SHOW TABLES
lists all the base tables and views in the current database (or the one explicitly named using the IN
clause) with names matching the optional regular expression. Wildcards in the regular expression can only be '*' for any character(s) or '|' for a choice. Examples are 'page_view', 'page_v*', '*view|page*', all which will match the 'page_view' table. Matching tables are listed in alphabetical order. It is not an error if there are no matching tables found in metastore. If no regular expression is given then all tables in the selected database are listed.
Show Partitions
SHOW PARTITIONS table_name; |
SHOW PARTITIONS lists all the existing partitions for a given base table. Partitions are listed in alphabetical order.
Version information
Icon
As of Hive 0.6, SHOW PARTITIONS can filter the list of partitions as shown below.
It is also possible to specify parts of a partition specification to filter the resulting list. For example:
SHOW PARTITIONS table_name PARTITION(ds= '2010-03-03' ); -- (Note: Hive 0.6 and later) SHOW PARTITIONS table_name PARTITION(hr= '12' ); -- (Note: Hive 0.6 and later) SHOW PARTITIONS table_name PARTITION(ds= '2010-03-03' , hr= '12' ); -- (Note: Hive 0.6 and later) |
Version information
Icon
Starting with Hive 0.13.0, SHOW PARTITIONS can specify a database (HIVE-5912).
SHOW PARTITIONS [db_name.]table_name [PARTITION(partition_spec)]; -- (Note: Hive 0.13 . 0 and later) |
Example:
SHOW PARTITIONS databaseFoo.tableBar PARTITION(ds= '2010-03-03' , hr= '12' ); -- (Note: Hive 0.13 . 0 and later) |
Show Table/Partition Extended
SHOW TABLE EXTENDED [IN|FROM database_name] LIKE identifier_with_wildcards [PARTITION(partition_spec)]; |
SHOW TABLE EXTENDED will list information for all tables matching the given regular expression. Users cannot use regular expression for table name if a partition specification is present. This command's output includes basic table information and file system information like totalNumberFiles, totalFileSize, maxFileSize, minFileSize,lastAccessTime, and lastUpdateTime. If partition is present, it will output the given partition's file system information instead of table's file system information.
Show Table Properties
Version information
Icon
As of Hive 0.10.0.
SHOW TBLPROPERTIES tblname; SHOW TBLPROPERTIES tblname( "foo" ); |
The first form lists all of the table properties for the table in question one per row separated by tabs. The second form of the command prints only the value for the property that's being asked for.
Show Create Table
SHOW CREATE TABLE ([db_name.]table_name|view_name); |
SHOW CREATE TABLE shows the CREATE TABLE statement that creates a given table, or the CREATE VIEW statement that creates a given view.
Show Indexes
Version information
Icon
As of Hive 0.7.
SHOW [FORMATTED] (INDEX|INDEXES) ON table_with_index [(FROM|IN) db_name]; |
SHOW INDEXES shows all of the indexes on a certain column, as well as information about them: index name, table name, names of the columns used as keys, index table name, index type, and comment. If the FORMATTED keyword is used, then column titles are printed for each column.
Show Columns
SHOW COLUMNS (FROM|IN) table_name [(FROM|IN) db_name]; |
SHOW COLUMNS shows all the columns in a table including partition columns.
Show Functions
SHOW FUNCTIONS "a.*" ; |
SHOW FUNCTIONS lists all the user defined and builtin functions matching the regular expression. To get all functions use ".*"
Show Granted Roles and Privileges
Hive Default Authorization - Legacy Mode has information about these SHOW statements:
In Hive 0.13.0 and later releases, SQL standard based authorization has these SHOW statements:
Show Locks
SHOW LOCKS <table_name>; SHOW LOCKS <table_name> EXTENDED; SHOW LOCKS <table_name> PARTITION (<partition_spec>); SHOW LOCKS <table_name> PARTITION (<partition_spec>) EXTENDED; SHOW LOCKS (DATABASE|SCHEMA) database_name; -- (Note: Hive 0.13.0 and later; SCHEMA added in Hive 0.14.0) |
SHOW LOCKS displays the locks on a table or partition. See Hive Concurrency Model for information about locks.
SHOW LOCKS (DATABASE|SCHEMA) is supported from Hive 0.13 for DATABASE (see HIVE-2093) and Hive 0.14 for SCHEMA (see HIVE-6601). SCHEMA and DATABASE are interchangeable – they mean the same thing.
When Hive transactions are being used, SHOW LOCKS returns this information (see HIVE-6460):
- database name
- table name
- partition name (if the table is partitioned)
- the state the lock is in, which can be:
- "acquired" – the requestor holds the lock
- "waiting" – the requestor is waiting for the lock
- "aborted" – the lock has timed out but has not yet been cleaned up
- the type of lock, which can be:
- "exclusive" – no one else can hold the lock at the same time (obtained mostly by DDL operations such as drop table)
- "shared_read" – any number of other shared_read locks can lock the same resource at the same time (obtained by reads; confusingly, an insert operation also obtains a shared_read lock)
- "shared_write" – any number of shared_read locks can lock the same resource at the same time, but no other shared_write locks are allowed (obtained by update and delete)
- ID of the transaction this lock is associated with, if there is one
- last time the holder of this lock sent a heartbeat indicating it was still alive
- the time the lock was acquired, if it has been acquired
- Hive user who requested the lock
- host the user is running on
Show Conf
SHOW CONF <configuration_name>; |
SHOW CONF returns a description of the specified configuration property.
- default value
- required type
- description
Note that SHOW CONF does not show the current value of a configuration property. For current property settings, use the "set" command in the CLI or a HiveQL script (see Commands) or in Beeline (see Beeline Hive Commands).
Show Transactions
SHOW TRANSACTIONS; |
SHOW TRANSACTIONS is for use by administrators when Hive transactions are being used. It returns a list of all currently open and aborted transactions in the system, including this information:
- transaction ID
- transaction state
- user who started the transaction
- machine where the transaction was started
Show Compactions
SHOW COMPACTIONS; |
SHOW COMPACTIONS returns a list of all tables and partitions currently being compacted or scheduled for compaction when Hive transactions are being used, including this information:
- database name
- table name
- partition name (if the table is partitioned)
- whether it is a major or minor compaction
- the state the compaction is in, which can be:
- "initiated" – waiting in the queue to be compacted
- "working" – being compacted
- "ready for cleaning" – the compaction has been done and the old files are scheduled to be cleaned
- thread ID of the worker thread doing the compaction (only if in working state)
- the time at which the compaction started (only if in working or ready for cleaning state)
Compactions are initiated automatically, but can also be initiated manually with an ALTER TABLE COMPACT statement.
[Hive - LanguageManual] Create/Drop/Grant/Revoke Roles and Privileges / Show Use的更多相关文章
- [Hive - LanguageManual] Create/Drop/Alter Database Create/Drop/Truncate Table
Hive Data Definition Language Hive Data Definition Language Overview Create/Drop/Alter Database Crea ...
- [Hive - LanguageManual] Create/Drop/Alter -View、 Index 、 Function
Create/Drop/Alter View Create View Drop View Alter View Properties Alter View As Select Version info ...
- [Hive - LanguageManual] Hive Default Authorization - Legacy Mode
Disclaimer Prerequisites Users, Groups, and Roles Names of Users and Roles Creating/Dropping/Using R ...
- postgreSQL 之 Privilege & grant & revoke(未完待续)
When an object is created, it is assigned an owner. The owner is normally the role that executed the ...
- [Hive - LanguageManual ] ]SQL Standard Based Hive Authorization
Status of Hive Authorization before Hive 0.13 SQL Standards Based Hive Authorization (New in Hive 0. ...
- create和grant配合使用,对Mysql进行创建用户和对用户授权
1.首先创建用户username以及密码passwd,授权主机localhost. create user ‘username’@'localhost' identified by 'passwd' ...
- 【转】MySQL GRANT REVOKE用法
MySQL的权限系统围绕着两个概念: 认证->确定用户是否允许连接数据库服务器 授权->确定用户是否拥有足够的权限执行查询请求等. 如果认证不成功的话,哪么授权肯定是无法进行的. revo ...
- mysql进阶(二十八)MySQL GRANT REVOKE用法
mysql进阶(二十八)MySQL GRANT REVOKE用法 MySQL的权限系统围绕着两个概念: 认证->确定用户是否允许连接数据库服务器: 授权->确定用户是否拥有足够的权限执 ...
- MYSQL用户权限管理(Grant,Revoke)
MySQL可以为不同的用户分配严格的.复杂的权限.这些操作大多都可以用SQL指令Grant(分配权限)和Revoke(回收权限)来实现. Grant可以把指定的权限分配给特定的用户,如果这个用户不存在 ...
随机推荐
- 发送消息执行记事本的“另存为”菜单功能(通过WM_COMMAND控制使用别的程序的菜单命令)
发送消息执行记事本的“另存为”菜单功能procedure TForm1.FormCreate(Sender: TObject);var hNotepad: Cardinal;begin hNotepa ...
- QT里使用sqlite的问题,好多坑
1. 我使用sqlite,开发机上好好的,测试机上却不行.后来发现是缺少驱动(Driver not loaded Driver not loaded),代码检查了又检查,发现应该是缺少dll文件(系统 ...
- The Introduction of Java Memory Leaks
One of the most significant advantages of Java is its memory management. You simply create objects a ...
- Java API —— TreeSet类
1.TreeSet类 1)TreeSet类概述 使用元素的自然顺序对元素进行排序 或者根据创建 set 时提供的 Comparator 进行排序 ...
- INSERT ... ON DUPLICATE KEY UPDATE Syntax
一 mybatis中返回自动生成的id 当有时我们插入一条数据时,由于id很可能是自动生成的,如果我们想要返回这条刚插入的id怎么办呢.在mysql数据中我们可以在insert下添加一个selectK ...
- TCP和UDP协议的应用/参数查看
TCP发送的包有序号,对方收到包后要给一个反馈,如果超过一定时间还没收到反馈就自动执行超时重发,因此TCP最大的优点是可靠.一般网页(http).邮件(SMTP).远程连接(Telnet).文件(FT ...
- maven小试牛刀
Maven是一个采用纯Java编写的开源项目管理工具.Maven采用了一种被称之为project object model (POM)概念来管理项目,所有的项目配置信息都被定义在一个叫做POM.xml ...
- eclipse的安装
eclipse的安装只要记住一条就好,那就是eclipse安装的时候版本要一致(就是,安装eclipse 32位的,同时要配套jdk 32位,tomcat 32位的),同理64位的也是一样的. 本人安 ...
- js实现ppt
实现ppt的js框架有很多,这里推荐几个: impress.js impress.js demo webSlide.js webSlide.js demo reveal.js ...
- uva live 6170
Esspe-Peasee Esspe-Peasee is an ancient game played by children throughout the land of Acmania. The ...