hive查询结果输出到hdfs上
insert overwrite directory "/mapredOutput/UserYesterdayInterest/${hiveconf:day}"
row format delimited fields terminated by "\t"
select
s.userid,
round(sum((s.totaloninvestedshare * i.yield/100 + s.addshare * s.addyield/100)/365),2) as yesterdayInterest,
unix_timestamp() as day
from
zx_standard_statistics s
left join zx_accounts a
on s.userid = a.userid
left join zx_standard_informations i
on s.bidno = i.bidno
where
a.totaloninvest > 0.00 and
s.totaloninvestedshare > 0 and
i.bidtype <> 'GREEN' and
i.startdate < unix_timestamp()
group by s.userid
;
将上述sql保存到yesterdayInetrest.sql文件中
执行hive -hiveconf day=20171204 -f yesterdayInterest.sql 实现参数传递
hive查询结果输出到hdfs上的更多相关文章
- shell脚本监控Flume输出到HDFS上文件合法性
在使用flume中发现由于网络.HDFS等其它原因,使得经过Flume收集到HDFS上得日志有一些异常,表现为: 1.有未关闭的文件:以tmp(默认)结尾的文件.加入存到HDFS上得文件应该是gz压缩 ...
- 使用MapReduce查询Hbase表指定列簇的全部数据输出到HDFS(一)
package com.bank.service; import java.io.IOException; import org.apache.hadoop.conf.Configuration;im ...
- 把HDFS上的数据导入到Hive中
1. 首先下载测试数据,数据也可以创建 http://files.grouplens.org/datasets/movielens/ml-latest-small.zip 2. 数据类型与字段名称 m ...
- 使用shell+awk完成Hive查询结果格式化输出
好久不写,一方面是工作原因,有些东西没发直接发,另外的也是习惯给丢了,内因所致.今天是个好日子,走起! btw,实际上这种格式化输出应该不只限于某一种需求,差不多是通用的. 需求: --基本的:当前H ...
- hive的数据导入与数据导出:(本地,云hdfs,hbase),列分隔符的设置,以及hdfs上传给pig如何处理
hive表的数据源有四种: hbase hdfs 本地 其他hive表 而hive表本身有两种: 内部表和外部表. 而hbase的数据在hive中,可以建立对应的外部表(参看hive和hbase整合) ...
- hive(在大数据集合上的类SQL查询和表)学习
1.jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true&characterEncoding=UTF-8&use ...
- cdh5.7 做完HA后hive 查询出现异常: expected: hdfs://nameservice
异常信息如下: select * from b_pt_pr_customer_address_info limit 19; FAILED: SemanticException Unable to de ...
- hive查询结果保存
参考: https://blog.csdn.net/zhuce1986/article/details/39586189 一.保存结果到本地 方法1:调用hive标准输出,将查询结果写到指定的文件中 ...
- Sqoop2入门之导入关系型数据库数据到HDFS上(sqoop2-1.99.4版本)
sqoop2-1.99.4和sqoop2-1.99.3版本操作略有不同:新版本中使用link代替了老版本的connection,其他使用类似. sqoop2-1.99.4环境搭建参见:Sqoop2环境 ...
随机推荐
- Getting the pixel coordinates of text or ticks in matplotlib
The exact pixel coordinates of title, labels, legends or ticks are important information for the tra ...
- sublime插件AndyJS2安装教程
1.下载AndyJS2包,已整理上传,下载AndyJS2.rar,附上网址.(https://github.com/jiaoxueyan/AndyJS2) 2.点击首选项(preference)=&g ...
- ES6 学习笔记之一 块作用域与let和const
---恢复内容开始--- 在学习ES6的块作用域和 let.const 之前,我们先来看看ES5以前的 var 关键字. var 关键字用于定义一个变量,通常我们会将其与变量的赋值合并为一条语句,就像 ...
- springMvc+swagger整合例子
Swagger 是一个规范和完整的框架,用于生成.描述.调用和可视化 RESTful 风格的 Web 服务.总体目标是使客户端和文件系统作为服务器以同样的速度来更新.文件的方法,参数和模型紧密集成到服 ...
- Centos-7 + Docker-1.12 中 devicemapper + direct_lvm 的 Docker 存储配置
html,body { font-size: 12pt } body { font-family: Helvetica, "Hiragino Sans GB", "微软雅 ...
- SQL SERVER FOR LINUX初体验
今天得空,就在Ubuntu17.04上安装了SQL SERVER 2017体验下,总体来说还是不错的. 在Ubuntu上安装SQL SERVER 2017还是比较方便的,只需几条命令即可: curl ...
- C/C++语言简介之编程开发
一.编译器 GCC:GNU组织开发的开源免费的编译器. MinGW:Windows操作系统下的GCC. Clang:开源的BSD协议的基于LLVM的编译器. Visual C++:Microsoft ...
- sphinx初识
sphinx(SQL Phrase Index),查询词组索引. 定义:Sphinx是一个全文检索引擎. 特性: 1.高速索引 (在新款CPU上,近10 MB/秒); 2.高速搜索 (2-4G的文本量 ...
- Spring data mongodb 替换 Repository 实现类,findAll 排除 字段
因文档比较大,有时候findAll 不想返回所有数据.没有找到默认的findAll 能够include 或者 exclude 的方法,所以想办法扩展一下实现类 query.fields().inclu ...
- webTest-----webUI自动化框架
webTest框架介绍 地址 https://github.com/wuranxu/webTest 希望大家能够喜欢!!! 简介 本框架基于Python3+selenium3+unittest组成,用 ...