阅读背景:

1.7 hive基本操作

来源:互联网 

一、基本命令和设置

1、命令

[root@hadoop-senior hive-0.13.1]# bin/hive
Logging initialized using configuration in jar:file:/opt/modules/hive-0.13.1/lib/hive-common-0.13.1.jar!/hive-log4j.properties
hive> show databases;
OK
default
Time taken: 0.367 seconds, Fetched: 1 row(s)
hive> show databases;
OK
default
Time taken: 0.013 seconds, Fetched: 1 row(s)
hive> create database db_hive;
OK
Time taken: 0.155 seconds
hive> show databases;         
OK
db_hive
default
Time taken: 0.011 seconds, Fetched: 2 row(s)
hive> use db_hive;   
OK
Time taken: 0.017 seconds
hive> create table student(id int,name string) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
OK
Time taken: 0.108 seconds
hive> show tables;
OK
student
Time taken: 0.016 seconds, Fetched: 1 row(s)
hive> desc student;
OK
id                      int                                         
name                    string                                      
Time taken: 0.098 seconds, Fetched: 2 row(s)

hive> desc formatted student;            #查看表结构详细信息
OK
# col_name                data_type               comment             
          
id                      int                                         
name                    string                                      
          
# Detailed Table Information          
Database:               db_hive                  
Owner:                  root                     
CreateTime:             Fri Apr 19 10:44:19 CST 2019     
LastAccessTime:         UNKNOWN                  
Protect Mode:           None                     
Retention:              0                        
Location:               hdfs://hadoop-senior.ibeifeng.com:8020/user/hive/warehouse/db_hive.db/student     #此表在HDFS上的存储位置
#在HDFS上分层存储的,数据库名/表名
Table Type:             MANAGED_TABLE          #表类型      
Table Parameters:          
    transient_lastDdlTime    1555641859          
          
# Storage Information          
SerDe Library:          org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe     
InputFormat:            org.apache.hadoop.mapred.TextInputFormat     
OutputFormat:           org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat     
Compressed:             No                       
Num Buckets:            -1                       
Bucket Columns:         []                       
Sort Columns:           []                       
Storage Desc Params:          
    field.delim             \t                  
    serialization.format    \t                  
Time taken: 0.074 seconds, Fetched: 28 row(s)[root@hadoop-senior hive



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: