hive 测试
hive> use gamedw;
OK
Time taken: 0.049 seconds
hive> select current_database();
OK
gamedw
Time taken: 0.485 seconds, Fetched: 1 row(s)
scala> hivecon.sql("select * from gamedw.customers where city='shenzhen'").show
+--------+---+---+----+
|custname|sex|age|city|
+--------+---+---+----+
+--------+---+---+----+
scala> hivecon.sql("insert overwrite table customers partition(city='shenzhen') select custname,sex,age from customers where city='nanjing'").show
18/09/10 17:24:18 ERROR hdfs.KeyProviderCache: Could not find uri with key [dfs.encryption.key.provider.uri] to create a keyProvider !!
18/09/10 17:24:18 WARN hive.log: Updating partition stats fast for: customers
18/09/10 17:24:18 WARN hive.log: Updated size to 96
++
||
++
++
scala> hivecon.sql("select * from gamedw.customers where city='shenzhen'").show
+---------------+---+---+--------+
| custname|sex|age| city|
+---------------+---+---+--------+
|tianyt_touch100| 1| 50|shenzhen|
| wangwu| 1| 85|shenzhen|
| zhangsan| 1| 20|shenzhen|
| liuqin| 0| 56|shenzhen|
| wangwu| 0| 47|shenzhen|
| liuyang| 1| 32|shenzhen|
| hello| 0|100|shenzhen|
+---------------+---+---+--------+
scala> hivecon.sql("insert into table customers partition(city='shenzhen') select custname,sex,age from customers where city='nanjing'").show
18/09/10 17:25:44 WARN hive.log: Updating partition stats fast for: customers
18/09/10 17:25:44 WARN hive.log: Updated size to 192
++
||
++
++
hive> alter table customers drop partition(city='luohe');
Dropped the partition city=luohe
OK
Time taken: 0.541 seconds
hive> alter table account clustered by (platid) sorted by(dateid) into 100 buckets;
OK
Time taken: 0.433 seconds
hive> show create table account;
OK
createtab_stmt
CREATE TABLE `account`(
`accountname` bigint,
`accid` bigint,
`platid` int,
`dateid` int,
`createtime` string)
COMMENT 'Imported by sqoop on 2018/08/30 14:07:03'
CLUSTERED BY (
platid)
SORTED BY (
dateid ASC)
INTO 100 BUCKETS
ROW FORMAT SERDE
'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'field.delim'='\u0001',
'line.delim'='\n',
'serialization.format'='\u0001')
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
'hdfs://localhost:9000/user/hive/warehouse/gamedw.db/account'
TBLPROPERTIES (
'last_modified_by'='root',
'last_modified_time'='1536573809',
'numFiles'='4',
'numRows'='0',
'rawDataSize'='0',
'totalSize'='3967930',
'transient_lastDdlTime'='1536573809')
Time taken: 0.25 seconds, Fetched: 32 row(s)
altere table .... archive partition会将这个分区的文件打成一个hadoop压缩包(har)文件,这样仅仅是降低文件数据,降低namenode的压力,而不会减少任何存储空间。
hive> set hive.archive.enabled=true;
hive> alter table customers archive partition(city='shenzhen');
intermediate.archived is hdfs://localhost:9000/user/hive/warehouse/gamedw.db/customers/city=shenzhen_INTERMEDIATE_ARCHIVED
intermediate.original is hdfs://localhost:9000/user/hive/warehouse/gamedw.db/customers/city=shenzhen_INTERMEDIATE_ORIGINAL
Creating data.har for hdfs://localhost:9000/user/hive/warehouse/gamedw.db/customers/city=shenzhen
in hdfs://localhost:9000/user/hive/warehouse/gamedw.db/customers/city=shenzhen/.hive-staging_hive_2018-09-10_18-09-33_034_2042188454765235088-1/-ext-10000/partlevel
Please wait... (this may take a while)
Moving hdfs://localhost:9000/user/hive/warehouse/gamedw.db/customers/city=shenzhen/.hive-staging_hive_2018-09-10_18-09-33_034_2042188454765235088-1/-ext-10000/partlevel to hdfs://localhost:9000/user/hive/warehouse/gamedw.db/customers/city=shenzhen_INTERMEDIATE_ARCHIVED
Moving hdfs://localhost:9000/user/hive/warehouse/gamedw.db/customers/city=shenzhen to hdfs://localhost:9000/user/hive/warehouse/gamedw.db/customers/city=shenzhen_INTERMEDIATE_ORIGINAL
Moving hdfs://localhost:9000/user/hive/warehouse/gamedw.db/customers/city=shenzhen_INTERMEDIATE_ARCHIVED to hdfs://localhost:9000/user/hive/warehouse/gamedw.db/customers/city=shenzhen
OK
Time taken: 6.035 seconds
hive 测试的更多相关文章
- 手把手教你搭建hadoop+hive测试环境(新手向)
本文由 网易云发布. 作者:唐雕龙 本篇文章仅限内部分享,如需转载,请联系网易获取授权. 面向新手的hadoop+hive学习环境搭建,加对我走过的坑总结,避免大家踩坑. 对于hive相关docke ...
- linux安装卸载MySQL以及密码设置+Hive测试
linux系统卸载MYSQL 1,先通过yum方式卸载mysql及相关组件 命令:yum remove mysql* 2.通过命令:rpm -qa|grep -i mysql 查找系统的有关于mysq ...
- 搭建sparksql的hive测试环境
sbt依赖 name := "Pi" version := "1.0" scalaVersion := "2.10.6" libraryDe ...
- Hive基础测试操作
一.Hive测试 1.查看数据库 show databases; 2.使用某个数据库,如默认数据库 user default; 3.创建表 create table if not exist itst ...
- Hive环境搭建及测试
前提条件:已经安装好如下软件 Eclipse4.5 hadoop-2.7.3 jdk1.7.0_79 此篇文章基于上一篇文章:zookeeper高可用集群搭建 什么是Hive? 1.Hive是一个基 ...
- Hive_初步见解,安装部署与测试
一.hive是什么东东 1. 个人理解 hive就是一个基于hdfs运行于MapReduce上的一个java项目, 这个项目封装了jdbc,根据hdfs编写了处理数据库的DDL/DML,自带的 二进制 ...
- cdh5.7权限测试示例
转载请注明出处:http://www.cnblogs.com/xiaodf/ 本文旨在展示CDH基于Kerberos身份认证和基于Sentry的权限控制功能的测试示例. 1. 准备测试数据 cat / ...
- Hive(五):hive与hbase整合
配置 hive 与 hbase 整合的目的是利用 HQL 语法实现对 hbase 数据库的增删改查操作,基本原理就是利用两者本身对外的API接口互相进行通信,两者通信主要是依靠hive_hbase-h ...
- hive部署手册
安装环境: 机器 只需要安装一台机器 操作系统:Ubuntu 11.04 64操作系统 hadoop:版本是1.0.2,安装在/usr/local/hadoop sun ...
随机推荐
- 测试教程网.unittest教程.5. 实例: 找出所有是弱密码的用户
From: http://www.testclass.net/pyunit/test_example_3/ 背景 当我们的测试数据是下面这些的时候,我们的用例是有问题的. [ {"name& ...
- Sublime Text 3中文乱码问题解决(最新)
Sublime Text 3是我MacBook Pro最喜欢的代码编辑器,没有之一,因为她的性感高亮代码配色,更因为它的小巧,但是它默认不支持GBK的编码格式,因此打开GBK的代码文件,如果里面有中文 ...
- shell文件描述符和重定向
1.文件描述符是与一个打开的文件或数据流相关联的整数.文件描述符0,1,2是系统预留的. 0 --------stdin(标准输入) 1 --------stdout(标准输出) 2--------- ...
- Spring Boot下Druid连接池+mybatis
目前Spring Boot中默认支持的连接池有dbcp,dbcp2, hikari三种连接池. 引言: 在Spring Boot下默认提供了若干种可用的连接池,Druid来自于阿里系的一个开源连 ...
- Eclipse使用Maven创建Web时错误:Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webap
网上也有好多方法我没有试成功,不过我将maven的conf setting.xml里的 阿里镜像给注释就可以了,你们也可以试试
- [UE4]一个好用的虚幻4插件,根据资源名称动态加载资源,GetCurrentLeveName(获得当前地图名称)
下载地址 一.下载与UE4相对应的版本 二.在工程根目录新建Plugins目录,解压插件. 三.如果工程已经打开,则需要重新打开 四.重新打开工程后,右下角会有提示有新插件可用. 五.这个插件提供 ...
- 0000 - Spring MVC 原理以及helloworld
1.概述 Spring MVC是目前最好的实现MVC设计模式的框架,是Spring框架的一个分支产品.以Spring IOC容器为基础,并利用容易的特性来简化它的配置.Spring MVC相当于Spr ...
- MySQL 之管理脚本
Mysql中查看每个IP的连接数 ) as ip , count(*) from information_schema.processlist group by ip;
- CRM 2016 IFrame_A嵌入 EXT.net 页面 a.aspx,刷新另一IFrame_B嵌入 b.aspx gird.
说白了就是一个IFrame页面,执行另一IFrame页面的函数. a.aspx JS: parent.Xrm.Page.getControl("IFRAME_B").getObj ...
- CRM 2016 执行IFrame 子页面中函数
CRM代码: var iframe = Xrm.Page.getControl("IFRAME_xxx").getObject(); iframe.contentWindow.Re ...