将mysql联合查询的结果导入到hdfs上

sqoop import --connect jdbc:mysql://ip/数据库 --username root --password 密码 --query "select p.bidNo as bidNo,p.interestTime as interestTime,p.status as status,p.planStatus as planStatus,
i.yield as yield,
i.startDate as startDate,
i.endDate as endDate,
i.cycle as cycle,
i.financedAmount as financedAmount,
e.interestType as interestType,
a.penaltyAmount as penaltyAmount,
(
case
when
(select count(1) from zx_standard_plan pp where pp.interestTime < p.interestTime and pp.bidNo = p.bidNo order by pp.interestTime desc limit 1) > 0
then (select TO_DAYS(date(from_unixtime(p.interestTime)))-TO_DAYS(date(from_unixtime((select pp.interestTime from zx_standard_plan pp where pp.interestTime < p.interestTime and pp.bidNo = p.bidNo order by pp.interestTime desc limit 1)))))
else (select TO_DAYS(date(from_unixtime(p.interestTime)))-TO_DAYS(date(from_unixtime(i.startDate))))
end) as days
from
zx_standard_plan p
left join zx_standard_informations i
on p.bidNo = i.bidNo
left join zx_standard_extra e
on e.bidNo = p.bidNo
left join zx_advance_repay a
on a.bidNo = p.bidNo
where
p.planStatus <> 'VOID' and
i.bidType <> 'GREEN' and
i.bidStatus <> 'FINISHED' and
\$CONDITIONS
order by p.interestTime asc" -m 1 --target-dir /zhongxin/standardPlanStatistics

  

sqoop:mysql to hdfs的更多相关文章

  1. 分布式计算(二)使用Sqoop实现MySQL与HDFS数据迁移

    近期接触了一个需求,业务背景是需要将关系型数据库的数据传输至HDFS进行计算,计算完成后再将计算结果传输回关系型数据库.听到这个背景,脑海中就蹦出了Sqoop迁移工具,可以非常完美的支持上述场景. 当 ...

  2. Hive+Sqoop+Mysql整合

    Hive+Sqoop+Mysql整合 在本文中,LZ随意想到了一个场景: 车,道路,监控,摄像头 即当一辆车在道路上面行驶的时候,道路上面的监控点里面的摄像头就会对车进行数据采集. 我们对采集的数据进 ...

  3. sqoop:mysql和Hbase/Hive/Hdfs之间相互导入数据

    1.安装sqoop 请参考http://www.cnblogs.com/Richardzhu/p/3322635.html 增加了SQOOP_HOME相关环境变量:source ~/.bashrc  ...

  4. 使用Sqoop从mysql向hdfs或者hive导入数据时出现的一些错误

    1.原表没有设置主键,出现错误提示: ERROR tool.ImportTool: Error during import: No primary key could be found for tab ...

  5. Sqoop mysql 数据导入到hdfs

    1.--direct 模式使用mysqldump 工具,所以节点上需要安装该工具,非direct 模式直接使用jdbc ,所以不需要 具体script参考如下: sqoop import --conn ...

  6. sqoop 操作从hdfs 导入到mysql中语句

    将hdfs下/dw/dms/usr_trgt下的文件导入到mysql中test数据库下usr_trgt表中 sqoop-export   --connect jdbc:mysql://mysqlDB: ...

  7. sqoop1.4.6从mysql导入hdfs\hive\hbase实例

    //验证sqoop是否连接到mysql数据库sqoop list-tables --connect 'jdbc:mysql://n1/guizhou_test?useUnicode=true& ...

  8. Sqoop导入到hdfs

    1.注意win下直接复制进linux 改一下--等 sqoop-list-databases --connect jdbc:mysql://122.206.79.212:3306/ --usernam ...

  9. sqoop导出到hdfs

    ./sqoop export --connect jdbc:mysql://192.168.58.180/db --username root --password 123456  --export- ...

随机推荐

  1. POJ 2125 Destroying The Graph [最小割 打印方案]

    Destroying The Graph Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 8311   Accepted: 2 ...

  2. .NET图表控件(LightningChart )的用法

    概述 LightningChart (LightningChart Ultimate) 软件开发工具包是微软Visual Studio 的一个插件,专攻大数据可视化呈现问题,用于 WPF(Window ...

  3. linux scp远程拷贝文件及文件夹

    [http://www.jb51.net/LINUXjishu/73131.html] 1.拷贝本机/home/administrator/test整个目录至远程主机192.168.1.100的/ro ...

  4. Java中的双重检查锁(double checked locking)

    最初的代码 在最近的项目中,写出了这样的一段代码 private static SomeClass instance; public SomeClass getInstance() { if (nul ...

  5. display 的 32 种写法

    从大的分类来讲, display的 32种写法可以分为 6个大类,再加上 1个全局类,一共是 7大类: 外部值 内部值 列表值 属性值 显示值 混合值 全局值 外部值 所谓外部值,就是说这些值只会直接 ...

  6. Jquery那些坑

    今天写Jquery的时候突然发现在将$("<td><td/>").appendTo(someElement)的时候发现一下子多出来两个,甚是奇怪,检查后端和 ...

  7. applicationContext.xml最基本配置文件

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  8. 《android开发艺术探索》读书笔记(十三)--综合技术

    接上篇<android开发艺术探索>读书笔记(十二)--Bitmap的加载和Cache No1: 使用CrashHandler来获取应用的crash信息 No2: 在Android中单个d ...

  9. B. Pyramid of Glasses

    原题链接 B. Pyramid of Glasses Mary has just graduated from one well-known University and is now attendi ...

  10. BUNOJ 1011

    字符串处理的题.原题链接 AC代码: #include<cstring> #include<cstdio> #include<string> #include< ...