Create/Drop/Grant/Revoke Roles and Privileges

Hive Default Authorization - Legacy Mode has information about these DDL statements:

For SQL standard based authorizationin Hive 0.13.0 and later releases, see these DDL statements:

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

Version information

Icon

As of Hive 0.10.

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

Version information

Icon

As of Hive 0.10.

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

Version information

Icon

As of Hive 0.14.0.

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

Version information

Icon

As of Hive 0.13.0 (see Hive 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

Version information

Icon

As of Hive 0.13.0 (see Hive Transactions).

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的更多相关文章

  1. [Hive - LanguageManual] Create/Drop/Alter Database Create/Drop/Truncate Table

    Hive Data Definition Language Hive Data Definition Language Overview Create/Drop/Alter Database Crea ...

  2. [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 ...

  3. [Hive - LanguageManual] Hive Default Authorization - Legacy Mode

    Disclaimer Prerequisites Users, Groups, and Roles Names of Users and Roles Creating/Dropping/Using R ...

  4. postgreSQL 之 Privilege & grant & revoke(未完待续)

    When an object is created, it is assigned an owner. The owner is normally the role that executed the ...

  5. [Hive - LanguageManual ] ]SQL Standard Based Hive Authorization

    Status of Hive Authorization before Hive 0.13 SQL Standards Based Hive Authorization (New in Hive 0. ...

  6. create和grant配合使用,对Mysql进行创建用户和对用户授权

    1.首先创建用户username以及密码passwd,授权主机localhost. create user ‘username’@'localhost' identified by 'passwd' ...

  7. 【转】MySQL GRANT REVOKE用法

    MySQL的权限系统围绕着两个概念: 认证->确定用户是否允许连接数据库服务器 授权->确定用户是否拥有足够的权限执行查询请求等. 如果认证不成功的话,哪么授权肯定是无法进行的. revo ...

  8. mysql进阶(二十八)MySQL GRANT REVOKE用法

    mysql进阶(二十八)MySQL GRANT REVOKE用法   MySQL的权限系统围绕着两个概念: 认证->确定用户是否允许连接数据库服务器: 授权->确定用户是否拥有足够的权限执 ...

  9. MYSQL用户权限管理(Grant,Revoke)

    MySQL可以为不同的用户分配严格的.复杂的权限.这些操作大多都可以用SQL指令Grant(分配权限)和Revoke(回收权限)来实现. Grant可以把指定的权限分配给特定的用户,如果这个用户不存在 ...

随机推荐

  1. Linux Shell脚本入门:tee命令

    用途说明   在执行Linux命令时,我们可以把输出重定向到文件中,比如 ls >a.txt,这时我们就不能看到输出了,如果我们既想把输出保存到文件中,又想在屏幕上看到输出内容,就可以使用tee ...

  2. Android Handler传值方式

    前面介绍handler的时候,也用到过几种传值方式,今天来总结一下,并且重点说一下bundle方式,代码如下: package com.handlerThread; import android.ap ...

  3. underscore.js 一个强大的js函数库

    Underscore提供的100多个函数,主要涉及对Collection.Object.Array.Function的操作: Collections(集合) each, map, reduce, re ...

  4. python 有关矩阵行列的存取 np.array

    初始化 a = range() a = np.array(a) a = a.reshape(,) a [[ 0  1  2  3]  [ 4  5  6  7]  [ 8  9 10 11]  [12 ...

  5. UVa 10256 - The Great Divide 判断凸包相交

    模板敲错了于是WA了好几遍…… 判断由红点和蓝点分别组成的两个凸包是否相离,是输出Yes,否输出No. 训练指南上的分析: 1.任取红凸包上的一条线段和蓝凸包上的一条线段,判断二者是否相交.如果相交( ...

  6. Web内容管理系统 Magnolia 介绍-挖掘优良的架构(1)

    Magnolia简介: Magnolia CMS是一家瑞士公司自2003年起发布的一个基于Java的开源内容管理系统.它适合且已被使用在以下领域:电子商务(例如:COOP.Migros.Rossman ...

  7. MySQL增加列,移动列

    ALTER TABLE test ADD COLUMN id INT UNSIGNED NOT NULL auto_increment PRIMARY KEY FIRST 给表添加列是一个常用的操作, ...

  8. UVa 10285 Longest Run on a Snowboard【记忆化搜索】

    题意:和最长滑雪路径一样, #include<iostream> #include<cstdio> #include<cstring> #include <c ...

  9. WebServices生成发布过程及常见问题的解决方法

    春夏秋冬走健康之路看四季养生网 健康饮食 养生问题 母婴保健 养生小常识 3.下一步,我们需要将Myservice文件夹拷贝到C:\Inetpub\wwwroot目录下(重要).如下图所示  然后依次 ...

  10. POJ 2446 Chessboard (二分图匹配)

    题意 在一个N*M的矩形里,用1*2的骨牌去覆盖该矩形,每个骨牌只能覆盖相邻的两个格子,问是否能把每个格子都盖住.PS:有K个孔不用覆盖. 思路 容易发现,棋盘上坐标和为奇数的点只会和坐标和为偶数的点 ...