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

相关推荐
linweidong18 分钟前
hive sql行转列,列转行sql的实例
hive·hadoop·sql
走遍西兰花.jpg1 天前
sqoop的导入导出
hive·hadoop·sqoop
LF3_1 天前
Centos7,搭建Hive3.1.3数据库
大数据·数据库·hive
一只大侠的侠2 天前
数据工程新范式“从ETL到ELT的平滑迁移实战指南”
数据仓库·etl
是阿威啊2 天前
【用户行为归因分析项目】- 【企业级项目开发第二站】项目通用代码开发
大数据·服务器·数据仓库·hive·hadoop
大千AI助手2 天前
HiveOperator 中 hql 模板路径解析失败的原因分析
hive·python·任务调度·airflow·模版·大千ai助手·hiveoperator
Hello.Reader2 天前
Hive Dialect 的查询能力支持哪些 HiveQL 子集,怎么写、怎么跑
数据仓库·hive·hadoop
是阿威啊3 天前
【用户行为归因分析项目】- 【企业级项目开发第三站】模拟DIM层设备、应用数据加载到Hive
数据仓库·hive·hadoop
麦聪聊数据3 天前
解构“逻辑数据仓库 (LDW)”与数据虚拟化
数据库·数据仓库·sql
小鸡脚来咯3 天前
Hive SQL与SQL不同处
hive·hadoop·sql