CREATE TABLE page_view(viewTime INT, userid BIGINT,p_date timestamp,
page_url STRING, referrer_url varchar(200),
ip STRING COMMENT 'IP Address of the User')
COMMENT 'This is the page view table'
PARTITIONED BY(dt STRING, country STRING)
STORED AS SEQUENCEFILE
TBLPROPERTIES ('creator'='wx','date'='2015-07-18'); CREATE TABLE students (name VARCHAR(64), age INT, gpa DECIMAL(3, 2))
CLUSTERED BY (age) INTO 2 BUCKETS STORED AS rcfile; CREATE TABLE user_info_bucketed(user_id BIGINT, firstname STRING, lastname STRING)
COMMENT 'A bucketed copy of user_info'
PARTITIONED BY(ds STRING)
CLUSTERED BY(user_id) SORTED BY(firstname) INTO 3 BUCKETS;
Show Databases
hive> show databases;
default
test
hive> SHOW DATABASES LIKE 'te*';
test
hive> SHOW DATABASES LIKE 'te*|de*';
default
test

Show Tables

hive> SHOW TABLES;
students
user_info_bucketed
hive> SHOW TABLES IN test;
students
user_info_bucketed
hive> use test;
hive> SHOW TABLES 'user*';
user_info_bucketed
hive> SHOW TABLES 'user*|stu*';
students
user_info_bucketed

Show Partitions

hive> SHOW PARTITIONS user_info_bucketed;
ds=2015-07-20
ds=2015-07-25
ds=2015-07-30
hive> SHOW PARTITIONS user_info_bucketed PARTITION(ds='2015-07-25');
ds=2015-07-25
hive> SHOW PARTITIONS test.user_info_bucketed PARTITION(ds='2015-07-25');
ds=2015-07-25
hive> SHOW TABLE EXTENDED in test LIKE 'user_info_bucketed' PARTITION(ds='2015-07-20');
tableName:user_info_bucketed
owner:wx
location:hdfs://ns1/user/hive/warehouse/test.db/user_info_bucketed/ds=2015-07-20
inputformat:org.apache.hadoop.mapred.TextInputFormat
outputformat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
columns:struct columns { i64 user_id, string firstname, string lastname}
partitioned:true
partitionColumns:struct partition_columns { string ds}
totalNumberFiles:3
totalFileSize:72
maxFileSize:36
minFileSize:14
lastAccessTime:1437793073583
lastUpdateTime:1437823862864

Show Table Properties

hive> SHOW TBLPROPERTIES page_view;
comment This is the page view table
creator wx
date 2015-07-18
transient_lastDdlTime 1437825559
hive> SHOW TBLPROPERTIES page_view("creator");
wx

Show Create Table

hive> SHOW CREATE TABLE page_view;

CREATE TABLE `page_view`(

  `viewtime` int,

  `userid` bigint,

  `p_date` timestamp,

  `page_url` string,

  `referrer_url` varchar(200),

  `ip` string COMMENT 'IP Address of the User')

COMMENT 'This is the page view table'

PARTITIONED BY (

  `dt` string,

  `country` string)

ROW FORMAT SERDE

  'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'

STORED AS INPUTFORMAT

  'org.apache.hadoop.mapred.SequenceFileInputFormat'

OUTPUTFORMAT

  'org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat'

LOCATION

  'hdfs://ns1/user/hive/warehouse/test.db/page_view'

TBLPROPERTIES (

  'creator'='wx',

  'date'='2015-07-18',

  'transient_lastDdlTime'='1437825559')

hive> SHOW CREATE TABLE user_info_bucketed;

CREATE TABLE `user_info_bucketed`(

  `user_id` bigint,

  `firstname` string,

  `lastname` string)

COMMENT 'A bucketed copy of user_info'

PARTITIONED BY (

  `ds` string)

CLUSTERED BY (

  user_id)

SORTED BY (

  firstname ASC)

INTO 3 BUCKETS

ROW FORMAT SERDE

  'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'

STORED AS INPUTFORMAT

  'org.apache.hadoop.mapred.TextInputFormat'

OUTPUTFORMAT

  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'

LOCATION

  'hdfs://ns1/user/hive/warehouse/test.db/user_info_bucketed'

TBLPROPERTIES (

  'transient_lastDdlTime'='1437793010')

hive> SHOW CREATE TABLE test.students;

CREATE TABLE `test.students`(

  `name` varchar(64),

  `age` int,

  `gpa` decimal(3,2))

CLUSTERED BY (

  age)

INTO 2 BUCKETS

ROW FORMAT SERDE

  'org.apache.hadoop.hive.serde2.columnar.LazyBinaryColumnarSerDe'

STORED AS INPUTFORMAT

  'org.apache.hadoop.hive.ql.io.RCFileInputFormat'

OUTPUTFORMAT

  'org.apache.hadoop.hive.ql.io.RCFileOutputFormat'

LOCATION

  'hdfs://ns1/user/hive/warehouse/test.db/students'

TBLPROPERTIES (

  'transient_lastDdlTime'='1437793374')

Show Indexes

hive> SHOW INDEXES ON user_info_bucketed;

inx_1                   user_info_bucketed      user_id                 test__user_info_bucketed_inx_1__        compact                 index-my!!!!       

hive> SHOW FORMATTED INDEXES ON user_info_bucketed;

idx_name                tab_name                col_names               idx_tab_name                    idx_type                comment 

inx_1                   user_info_bucketed      user_id                 test__user_info_bucketed_inx_1__        compact                 index-my!!!!       

hive> SHOW FORMATTED INDEXES ON user_info_bucketed IN test;

inx_1                   user_info_bucketed      user_id                 test__user_info_bucketed_inx_1__        compact                 index-my!!!!

Show Columns

hive> SHOW COLUMNS IN page_view;

viewtime           

userid             

p_date             

page_url           

referrer_url       

ip                 

dt                 

country            

hive> SHOW COLUMNS IN page_view in test;

viewtime           

userid             

p_date             

page_url           

referrer_url       

ip                 

dt                 

country

Show Functions

hive> SHOW FUNCTIONS;

hive> SHOW FUNCTIONS "a.*";

SHOW FUNCTIONS is deprecated, please use SHOW FUNCTIONS LIKE instead.

abs

acos

add_months

and

array

array_contains

ascii

asin

assert_true

atan

avg

hive> SHOW FUNCTIONS LIKE "a*";

abs

acos

add_months

and

array

array_contains

ascii

asin

assert_true

atan

avg

hive> SHOW FUNCTIONS LIKE "*a*";

Show Conf

Note that SHOW CONF does not show the current value of a configuration property. 

hive> SHOW CONF 'hive.exec.parallel';
false BOOLEAN Whether to execute jobs in parallel

Hive show的更多相关文章

  1. 初识Hadoop、Hive

    2016.10.13 20:28 很久没有写随笔了,自打小宝出生后就没有写过新的文章.数次来到博客园,想开始新的学习历程,总是被各种琐事中断.一方面确实是最近的项目工作比较忙,各个集群频繁地上线加多版 ...

  2. Hive安装配置指北(含Hive Metastore详解)

    个人主页: http://www.linbingdong.com 本文介绍Hive安装配置的整个过程,包括MySQL.Hive及Metastore的安装配置,并分析了Metastore三种配置方式的区 ...

  3. Hive on Spark安装配置详解(都是坑啊)

    个人主页:http://www.linbingdong.com 简书地址:http://www.jianshu.com/p/a7f75b868568 简介 本文主要记录如何安装配置Hive on Sp ...

  4. HIVE教程

    完整PDF下载:<HIVE简明教程> 前言 Hive是对于数据仓库进行管理和分析的工具.但是不要被“数据仓库”这个词所吓倒,数据仓库是很复杂的东西,但是如果你会SQL,就会发现Hive是那 ...

  5. 基于Ubuntu Hadoop的群集搭建Hive

    Hive是Hadoop生态中的一个重要组成部分,主要用于数据仓库.前面的文章中我们已经搭建好了Hadoop的群集,下面我们在这个群集上再搭建Hive的群集. 1.安装MySQL 1.1安装MySQL ...

  6. hive

    Hive Documentation https://cwiki.apache.org/confluence/display/Hive/Home 2016-12-22  14:52:41 ANTLR  ...

  7. 深入浅出数据仓库中SQL性能优化之Hive篇

    转自:http://www.csdn.net/article/2015-01-13/2823530 一个Hive查询生成多个Map Reduce Job,一个Map Reduce Job又有Map,R ...

  8. Hive读取外表数据时跳过文件行首和行尾

    作者:Syn良子 出处:http://www.cnblogs.com/cssdongl 转载请注明出处 有时候用hive读取外表数据时,比如csv这种类型的,需要跳过行首或者行尾一些和数据无关的或者自 ...

  9. Hive索引功能测试

    作者:Syn良子 出处:http://www.cnblogs.com/cssdongl 转载请注明出处 从Hive的官方wiki来看,Hive0.7以后增加了一个对表建立index的功能,想试下性能是 ...

  10. 轻量级OLAP(二):Hive + Elasticsearch

    1. 引言 在做OLAP数据分析时,常常会遇到过滤分析需求,比如:除去只有性别.常驻地标签的用户,计算广告媒体上的覆盖UV.OLAP解决方案Kylin不支持复杂数据类型(array.struct.ma ...

随机推荐

  1. eclipse 搜索 正则表达式

    1.换行搜索,如下: \.dyform\([\r]*[\s]*\{

  2. SpringMVC------maven编译报错:Dynamic Web Module 3.0 requires Java 1.6 or newer

    如图所示: 但是 Eclipse 明明已经将编译级别设置为 1.7: 这是由于你的 Maven 编译级别是 jdk1.5 或以下,而你导入了 jdk1.6 以上的依赖包:查看 Eclipse 的 Na ...

  3. IIS------如何占用80端口

    如何占用80端口 请看我的一篇随笔: https://www.cnblogs.com/tianhengblogs/p/9292347.html

  4. Java虚拟机(一):JVM内存结构

    所有的Java开发人员可能会遇到这样的困惑?我该为堆内存设置多大空间呢?OutOfMemoryError的异常到底涉及到运行时数据的哪块区域?该怎么解决呢?其实如果你经常解决服务器性能问题,那么这些问 ...

  5. Java -- 异常的捕获及处理 -- 自定义异常类

    7.4 自定义异常类 定义异常类只需要继承Exception类即可. 例:自定义异常类 Class : MyException package limeThrowable._7_4; public c ...

  6. 5 -- Hibernate的基本用法 --4 4 数据库方言

    Hibernate底层依然使用SQL语句来执行数据库操作,虽然所有关系数据库都支持使用标准SQL语句,但所有数据库都对标准SQL进行了一些扩展,所以在语法细节上存在一些差异.因此,Hibernate需 ...

  7. GoF--服务定位器模式

    服务定位器模式(Service Locator Pattern)用在我们想使用 JNDI 查询定位各种服务的时候.考虑到为某个服务查找 JNDI 的代价很高,服务定位器模式充分利用了缓存技术.在首次请 ...

  8. ios开发之--armv7,armv7s,arm64,i386,x86_64详解

    有时候在运行的时候,经常出现诸如i386的错误,最新一些可能会出现 No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch ...

  9. 【Android】amr播放

    http://download.csdn.net/download/r8hzgemq/4877495 http://www.cnblogs.com/fengzhblog/archive/2013/08 ...

  10. 虚拟机中多个Linux系统之间配置免秘钥访问

    1.三个节点cdh1,cdh2,cdh3 2.在每个机器上分别生产公钥对 ssh-keygen -t rsa 3.复制公钥 cd .ssh cat  id_rsa.pub  >> auth ...