hive总结

启动源服务

hive --service metastore

ss -nal 查看端口

CREATE TABLE student2(

id int,

name string,

sex string,

age int

)

row format delimited

fields terminated by ',';

create table students(

student_name string ,

likes array<string>,

address map<string,string>

)

row format delimited

fields terminated by ','

collection items terminated by '-'

map keys terminated by ':';

查看数据表结构

desc formatted students;

OK

col_name data_type comment

student_name string

likes array<string>

address map<string,string>

Detailed Table Information

Database: default

Owner: root

CreateTime: Fri Jul 17 10:15:34 EDT 2020

LastAccessTime: UNKNOWN

Retention: 0

Location: hdfs://mycluster/hive/warehouse/students

Table Type: MANAGED_TABLE

Table Parameters:

COLUMN_STATS_ACCURATE {\"BASIC_STATS\":\"true\"}

numFiles 0

numRows 0

rawDataSize 0

totalSize 0

transient_lastDdlTime 1594995334

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:

colelction.delim -

field.delim ,

mapkey.delim :

serialization.format ,

Time taken: 0.136 seconds, Fetched: 35 row(s)

zhangsan,1-2-3,shanxi:shanxi-xian-yanta:luonan

zhangsan,1-2-3,shaaxi:shanxi-xian-yanta:luona

zhangsan,1-2-3,sichuan:shanxi-xian-yanta:luona

zhangsan,1-2-3,henan:shanxi-xian-yanta:luona

zhangsan,1-2-3,hebei:shanxi-xian-yanta:luona

hive 默认的分割符

内部表和外部表的区别

内部表创建有默认存储位置,外部表需要指定路径

内部表删除元数据和数据,外部表只删除元数据,不删除数据

单 分区

create table students2(

student_name string ,

likes array<string>,

address map<string,string>

)

partitioned by (age int)

row format delimited

fields terminated by ','

collection items terminated by '-'

map keys terminated by ':';

相关推荐
AI_567812 小时前
Hive SQL优化:分区表+分桶表提升查询效率
人工智能·hive·ai
莫叫石榴姐1 天前
数据开发需求工时如何评估?
大数据·数据仓库·人工智能·数据分析·产品运营
xiaomici2 天前
SAC - Addin
数据仓库
edisao2 天前
第三章 合规的自愿
jvm·数据仓库·python·神经网络·决策树·编辑器·动态规划
Aloudata2 天前
NoETL 指标平台与现有数据中台、治理体系的融合之道
数据仓库·数据分析·自动化·etl·noetl
2501_927283583 天前
你的仓库,还停留在“人找货”的时代吗?
运维·数据仓库·人工智能·自动化·wms
莽撞的大地瓜3 天前
新浪舆情通秒级预警筑牢舆情应急第一防线
大数据·数据库·数据仓库·数据分析
旺仔Sec3 天前
手把手教你从零搭建 Hive 2.3.6 + MySQL 元数据存储(含视频教程)
hive·hadoop·mysql
人道领域4 天前
SSM框架从入门到入土(SpringMVC入门开发全流程解析)
数据仓库·hive·hadoop
Mr泓4 天前
数据仓库建设-(数仓分层篇)
大数据·数据仓库·hive