hive 创建三种文件类型的表
--TextFile
set hive.exec.compress.output=true;
set mapred.output.compress=true;
set mapred.output.compression.codec=org.apache.hadoop.io.compress.GzipCodec;
set io.compression.codecs=org.apache.hadoop.io.compress.GzipCodec;
INSERT OVERWRITE table hzr_test_text_table PARTITION(product='xxx',dt='2013-04-22')
SELECT xxx,xxx.... FROM xxxtable WHERE product='xxx' AND dt='2013-04-22';
--SquenceFile
set hive.exec.compress.output=true;
set mapred.output.compress=true;
set mapred.output.compression.codec=org.apache.hadoop.io.compress.GzipCodec;
set io.compression.codecs=org.apache.hadoop.io.compress.GzipCodec;
set io.seqfile.compression.type=BLOCK;
INSERT OVERWRITE table hzr_test_sequence_table PARTITION(product='xxx',dt='2013-04-22')
SELECT xxx,xxx.... FROM xxxtable WHERE product='xxx' AND dt='2013-04-22';
--RCFile
set hive.exec.compress.output=true;
set mapred.output.compress=true;
set mapred.output.compression.codec=org.apache.hadoop.io.compress.GzipCodec;
set io.compression.codecs=org.apache.hadoop.io.compress.GzipCodec;
INSERT OVERWRITE table hzr_test_rcfile_table PARTITION(product='xxx',dt='2013-04-22')
SELECT xxx,xxx.... FROM xxxtable WHERE product='xxx' AND dt='2013-04-22';
动态分区插入
set hive.exec.compress.output=true;
set mapred.output.compress=true;
SET hive.exec.dynamic.partition=true;
SET hive.exec.dynamic.partition.mode=nonstrict;
SET hive.exec.max.dynamic.partitions.pernode = 1000;
SET hive.exec.max.dynamic.partitions=1000;
INSERT overwrite TABLE t_lxw1234_partitioned PARTITION (month,day)
SELECT url,substr(day,1,7) AS month,day
FROM t_lxw1234;
注意:在PARTITION (month,day)中指定分区字段名即可;
在SELECT子句的最后两个字段,必须对应前面PARTITION (month,day)中指定的分区字段,包括顺序。
4 行转换列: 单表下写法
hive如何将
a b 1
a b 2
a b 3
c d 4
c d 5
c d 6
变为:
a b 1,2,3
c d 4,5,6
select col1,col2,concat_ws(',',collect_set(col3))
from tmp_jiangzl_test
group by col1,col2; ----------------》 已经验证过 OK
添加metastore启动脚本bin/hive-metastore.sh
#!/bin/sh
nohup ./hive --service metastore >> metastore.log 2>&1 &
echo $! > hive-metastore.pid
添加hive server启动脚本bin/hive-server.sh
nohup ./hive --service hiveserver >> hiveserver.log 2>&1 &
echo $! > hive-server.pid
启动metastore和hive server
./hive-metastore.sh
./hive-server.sh
nohup ./hiveserver2 >> hiveserver.log 2>&1 &
beeline参数设置:https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients
hive 创建三种文件类型的表的更多相关文章
- Hive的三种Join方式
Hive的三种Join方式 hive Hive中就是把Map,Reduce的Join拿过来,通过SQL来表示. 参考链接:https://cwiki.apache.org/confluence/dis ...
- Delphi中定义了四种布尔类型:Boolean,ByteBool,WordBool和LongBool。后面三种布尔类型是为了与其他语言兼容而引入的
bool是LongBool类型. Delphi中定义了四种布尔类型:Boolean,ByteBool,WordBool和LongBool.后面三种布尔类型是为了与其他语言兼容而引入的,一般情况下建议使 ...
- Linux 下的7种文件类型
普通文件类型 (-)Linux中最多的一种文件类型, 包括 纯文本文件(ASCII):二进制文件(binary):数据格式的文件(data);各种压缩文件.第一个属性为 [-] ,这些文件一般是用一些 ...
- linux文件的3个时间和7种文件类型
linux文件的三个时间: atime: access time --最近访问时间. ctime: change time --最近改变时间. mtime:modify time --最近修改时间. ...
- Objective-C:三种文件导入的方式以及atomic和nonatomic的区别
一.三种文件导入的方式比较: 类的前项声明@class.import.include: 1.采用@class 类名的方式,它会告诉编译器有这么一个类,目前不需要知道它内部的实例变量和方法是如何定义 ...
- java Data、String、Long三种日期类型之间的相互转换
java Data.String.Long三种日期类型之间的相互转换 // date类型转换为String类型 // formatType格式为yyyy-MM-dd HH:mm:ss// ...
- sql server 性能调优之 资源等待内存瓶颈的三种等待类型
一.概述 这篇介绍Stolen内存相关的主要三种等待类型以及对应的waittype编号,CMEMTHREAD(0x00B9),SOS_RESERVEDMEMBLOCKLIST(0x007B),RESO ...
- SEO三种职位类型:编辑型SEO、技术型SEO、营销型SEO详解
SEO三种职位类型:编辑型SEO.技术型SEO.营销型SEO详解 网站SEO优化作为营销端的服务之一,这些年也呈现出日新月异的格局.一改过去游兵散将式的小作坊生产模式,不断有力量强大的公司团体加入到这 ...
- Objective-C:三种文件导入的方式比较
三种文件导入的方式比较: 类的前项声明@class.import.include: 1.采用@class 类名的方式,它会告诉编译器有这么一个类,目前不需要知道它内部的实例变量和方法是如何定义 ...
随机推荐
- Asp.Net Core--发布到IIS
翻译如下: 支持的操作系统 Windows 7及更高版本 Windows Server 2008 R2及更高版本 概念上,本文档中描述的IIS配置也适用于在Nano Server IIS上托管ASP. ...
- web自动化工具-Browsersync
web自动化工具-Browsersync browser-sync才是神器中的神器,和livereload一样支持监听所有文件.可是和livereload简单粗暴的F5刷新相比,browsersync ...
- 生产环境中,数据库升级维护的最佳解决方案flyway
官网:https://flywaydb.org/ 转载:http://casheen.iteye.com/blog/1749916 1. 引言 想到要管理数据库的版本,是在实际产品中遇到问题后想到的 ...
- HDU4329
#include<cstdio> #include<algorithm> #include<map> using namespace std; int main() ...
- BZOJ3522——[Poi2014]Hotel
1.题意:http://www.lydsy.com/JudgeOnline/problem.php?id=3522 2.分析:这道题有两种情况,第一个是三个点在同一个链上,这显然不可能了,因为树上的路 ...
- CSS & JS 制作滚动幻灯片
==================纯CSS方式==================== <!DOCTYPE html> <html> <head> <met ...
- html图标插件
https://bitbucket.org/cleonello/jqplot/downloads/ 下载地址 http://www.cnblogs.com/yaozhenfa/p/jqplot-pie ...
- Swift 备忘单和快速参考
Variables var myInt = var myExplicitInt: Int = // explicit type var x = , y = , z = // declare multi ...
- 常见端口 HTTP代码
端口号 系统保留了前0到1023端口作为常用的网络服务. 0-1023 公认端口 1024-49151 注册端口 49152-65535 动态或私有端口 1 TCPMUX 主要在SGI Irix机器 ...
- ajax提交form表单
1. ajax提交form表单和不同的form表单的提交主要区别在于,ajax提交表单是异步提交的,而普通的是同步提交的表单. 2. from视图部分 <form id="loginF ...