【问题标题】:Get data in the last three months using talend (Big Data Hive)使用 talend (Big Data Hive) 获取最近三个月的数据
【发布时间】:2019-03-22 03:53:50
【问题描述】:

我有一个查询要使用 talend 从大数据配置单元中获取所有数据作为源

这是我通常使用的查询:

SELECT 
  bd_bt_xyz.xllnis05_timestamp, 
  bd_bt_xyz.xllnis05_key, 
  .
  . (too many field)
  .
  bd_bt_xyz.xln_cr_in_un_bl_dt, 
  bd_bt_xyz.date_pr
FROM newmisplus2.bd_bt_llnis05
LIMIT 1000000

从现在开始我需要修改查询以仅获取 talend 中过去三个月的数据,但我仍然不知道该怎么做。

*注意:字段 bd_bt_xyz.date_pr 是数据创建日期。

【问题讨论】:

    标签: hive hiveql talend


    【解决方案1】:

    使用过滤器:

    where bd_bt_xyz.date_pr >= add_months(current_date, -3)
    

    Talend 中的类似内容:

    "select 
     ...
    where bd_bt_xyz.date_pr >= '" +TalendDate.addDate(TalendDate.getDate("yyyy-MM-dd"),"yyyy-MM-dd",-3,"MM")+ "'" 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-08
      • 1970-01-01
      相关资源
      最近更新 更多