zoukankan      html  css  js  c++  java
  • sqoop将mysql连表查询结果导入hdfs文件

    sqoop import --connect jdbc:mysql://ip/数据库 --username 用户名 --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
    

     --query  " 双引号 "  使用   $CONDITIONS 

           '单引号'  使用  $CONDITIONS

  • 相关阅读:
    cc.Component
    cc.Node—坐标系统
    cc.Node—事件响应
    cc.Node—Action
    cc.Node—场景树
    console.log格式化及console对象
    网站开发学习Python实现-Django项目部署-介绍(6.2.1)
    个人博客搭建Python实现-尝试-遇到的问题(10.1.1)
    工具-Redis-django存储session(99.6.4)
    工具-Redis-与Python一起使用(99.6.3)
  • 原文地址:https://www.cnblogs.com/Smilence1024/p/8041182.html
Copyright © 2011-2022 走看看