[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可以把指定的权限分配给特定的用户,如果这个用户不存在 ...
随机推荐
- 获取其他进程中ListBox和ComboBox的内容
(*// 标题:获取其他进程中ListBox和ComboBox的内容 说明:Window2000+Delphi6调试通过 设计:Zswang 支持:wjhu111@21cn.com 日期:2004-0 ...
- java:接口实例
接口:打印机接口 interface Printer { public void read(); } 函数一:佳能打印机 class CanPrinter implements Printer { p ...
- AO总结10:MapControl控件
MapControl对应ArcMap中的数据视图,它封装了Map对象,并提供了额外的属性.方法.事件用于: 1 管理控件的外观.显示属性和地图属性 2 添加并管理控件中的数据层 3 装载Map文档控件 ...
- Haxe - Actuate.Tween
方法解释: Actuate.tween( target : Dynamic , duration : Float , properties : Dynamic , ?overwrite : Bool ...
- Android 学习(一)
这几天被一些功能折磨的要死了,于是放下了这个,看点其它的东西,算是转移一下焦点.床头放了不少书籍,也都被翻阅过,翻阅过,却不曾细细的品味过,俗话说,书可借而不可买也,这话用到自己的身上丝毫不错.因为是 ...
- BNU OJ 33691 / LA 4817 Calculator JAVA大数
留着当个模板用,在BNU上AC,在LA上RE……可能是java的提交方式不同??? 数和运算符各开一个栈. 表达式从左到右扫一遍,将数存成大数,遇到数压在 数的栈,运算符压在 运算符的栈,每当遇到右括 ...
- apk反编译(8)如何完全防止反编译?
在android 的应用很难做到完全防止反编译,即使用ProGuard混淆的后,也能得到smali代码,这个语法也很简单,很容易理解. 只能通过增加破解难度和成本,使破解者失去耐心. 其中一个常见解决 ...
- BZOJ 2154 Crash的数字表格
题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=2154 题意: 思路: i64 mou[N]; void init(int N){ ...
- 关于 Memcached 的一些使用
关于Memcached的一些用法, Memcached 在Windows下的版本费了很大劲,才找到.win32,win64都有.本来想自己build的,但是Cygwin下载包也是费老劲了,下不下来. ...
- 8天学通MongoDB——第七天 运维技术
这一篇我们以管理员的视角来看mongodb,作为一名管理员,我们经常接触到的主要有4个方面: 1. 安装部署 2. 状态监控 3. 安全认证 4. 备份和恢复, 下面我们就一点一点的讲解. 一 ...