大数据学习——hive使用】的更多相关文章

1 建表 create table student(id int,name string ,age int) row format delimitedfields terminated by ','; 2 创建一个student.txt 添加数据 ,zhangsan, ,lisi, ,wnagwu, 3 上传 hdfs dfs -put student.txt /user/hive/warehouse/student 4 select * from student; 5 通常不会通过put方式加…
1. hive的数据类型Hive的内置数据类型可以分为两大类:(1).基础数据类型:(2).复杂数据类型2. hive基本数据类型基础数据类型包括:TINYINT,SMALLINT,INT,BIGINT,BOOLEAN,FLOAT,DOUBLE,STRING,BINARY,TIMESTAMP,DECIMAL,CHAR,VARCHAR,DATE. 3. hive集合类型集合类型主要包括:array,map,struct等,hive的特性支持集合类型,这特性是关系型数据库所不支持的,利用好集合类型可…
1 内置函数 测试各种内置函数的快捷方法: 1.创建一个dual表 create table dual(id string); 2.load一个文件(一行,一个空格)到dual表 3.select substr('angelababy',2,3) from dual; 2 自定义函数UDF(user-defined function)和transform 自定义函数类别 UDF  作用于单个数据行,产生一个数据行作为输出.(数学函数,字符串函数) UDAF(用户定义聚集函数):接收多个输入数据行…
1新建一个数据库 create database db3; 2创建一个外部表 --外部表建表语句示例: create external table student_ext(Sno int,Sname string,Sex string,Sage int,Sdept string) row format delimited fields terminated by ',' location '/stu'; 3添加数据 vi student.txt ,李勇,男,,CS ,刘晨,女,,IS ,王敏,女…
show databases; desc t_partition001; desc extended t_partition002; desc formatted t_partition002; !clear; !ls; dfs -ls /; 2 DML操作 load load data local inpath '/root/hivedata/t_partitioned' into table t_partition001 partition(country="Japan"); lo…
1上传压缩包 2 解压 tar -zxvf apache-hive-1.2.1-bin.tar.gz -C apps 3 重命名 mv apache-hive-1.2.1-bin hive 4 设置环境变量 vi /etc/profile expert HIVE_HOME=/root/apps/hiveexport PATH=$PATH:$HIVE_HOME/bin 5 启动hive cd apps/hive bin/hive 出现上面的问题是因为版本不兼容 解决一下版本不兼容问题:替换 app…
ABC三个hive表 每个表中都只有一列int类型且列名相同,求三个表中互不重复的数 create table a(age int) row format delimited fields terminated by ','; create table b(age int) row format delimited fields terminated by ','; create table c(age int) row format delimited fields terminated by…
1 创建一个分区表 create table t_partition001(ip string,duration int) partitioned by(country string) row format delimited fields terminated by ','; 2 添加数据 load data local inpath '/root/hivedata/t_partitioned' into table t_partition001 partition(country="Chin…
Hive交互shell bin/hive Hive JDBC服务 hive也可以启动为一个服务器,来对外提供 启动方式,(假如是在itcast01上): 启动为前台:bin/hiveserver2 启动为后台:nohup bin/hiveserver2 1>/var/log/hiveserver.log 2>/var/log/hiveserver.err & 启动成功后,可以在别的节点上用beeline去连接 v  方式(1) hive/bin/beeline  回车,进入beelin…
引言 在大数据学习系列之一 ----- Hadoop环境搭建(单机) 成功的搭建了Hadoop的环境,在大数据学习系列之二 ----- HBase环境搭建(单机)成功搭建了HBase的环境以及相关使用介绍.本文主要讲解如何搭建Hadoop+Hive的环境. 一.环境准备 1,服务器选择 本地虚拟机 操作系统:linux CentOS 7 Cpu:2核 内存:2G 硬盘:40G 说明:因为使用阿里云服务器每次都要重新配置,而且还要考虑网络传输问题,于是自己在本地便搭建了一个虚拟机,方便文件的传输以…