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 ':';

相关推荐
青春万岁!!21 小时前
hive分区表加字段后insert字段为空
数据仓库·hive·hadoop
Database_Cool_2 天前
AnalyticDB MySQL vs StarRocks/ByteHouse:云数仓选型指南——全托管 vs 自建方案
数据库·数据仓库·mysql·阿里云
涤生大数据2 天前
从 ETL 到 Agent:AI数据工程如何搭建企业级“数据工厂“
数据仓库·人工智能·etl
Database_Cool_3 天前
AnalyticDB MySQL vs Hologres:阿里云内部数仓产品如何选——场景化选型指南
数据库·数据仓库·mysql·阿里云
Nefu_lyh3 天前
【Hive】三、Hive 抽样:讲解 Hive 三大抽样方式:分桶抽样、块抽样、随机抽样的原理、语法、性能对比与实战案例
数据仓库·hive·hadoop
段一凡-华北理工大学3 天前
工业领域的Hadoop架构学习~系列文章16:实时流处理架构 - 工业数据的实时动脉
大数据·数据仓库·hadoop·分布式·学习·架构·高炉炼铁
Database_Cool_4 天前
AnalyticDB MySQL vs ClickHouse:OLAP 数据库选型深度对比——谁更适合企业级分析
数据库·数据仓库·mysql·数据分析
真上帝的左手4 天前
19. 大数据- BI 入门-数仓实战1-数据仓库的核心逻辑与落地范式
大数据·数据仓库·bi
Database_Cool_4 天前
AnalyticDB MySQL vs Apache Doris:企业级云数仓如何选型——全维度对比指南
数据库·数据仓库·mysql·阿里云
真上帝的左手4 天前
19. 大数据- BI 入门-数仓实战4-DIM 维度层
大数据·数据仓库·bi