【问题标题】:Where clause with dates in hive配置单元中带有日期的 Where 子句
【发布时间】:2018-01-29 18:11:35
【问题描述】:

以下配置单元查询中的 where 子句不起作用

 select
 e.num as badge
from dbo.events as e
 where  TO_DATE(e.event_time_utc) > TO_DATE(select event_date from DL_EDGE_LRF_facilities.card_swipes_lastpulldate)

event_time_utc 和 event_date 字段都定义为字符串,并且 event_time_utc 具有时间戳值,例如“2017-09-18 20:10:19.000000”,而 event_date 只有一个日期值,例如“2018-01-25” 当我运行查询时,我收到一个错误,例如“无法识别函数规范中'select''event_date''来自'附近的输入”,请帮助

【问题讨论】:

    标签: hive


    【解决方案1】:

    @user86683; hive 无法识别语法,因为它不允许在不等式条件 (>) 中进行查询。你可以试试这个查询,让我知道结果。

    select e.num as badge
    from dbo.events as e, DL_EDGE_LRF_facilities.card_swipes_lastpulldate c
    where  TO_DATE(e.event_time_utc) > TO_DATE(c.event_date)
    

    您会收到一条警告,但您可以忽略它,因为 event_date 的表只有一条记录。

    Warning: Map Join MAPJOIN[10][bigTable=e] in task 'Map 1' is a cross product
    Query ID = xxx_20180201102128_aaabb2235-ee69275cbec1
    Total jobs = 1
    Launching Job 1 out of 1
    Status: Running (Executing on YARN cluster with App id application_09fdf345)
    

    希望这会有所帮助。谢谢。

    【讨论】:

      猜你喜欢
      • 2023-04-04
      • 2021-11-30
      • 1970-01-01
      • 2018-10-06
      • 1970-01-01
      • 1970-01-01
      • 2015-06-30
      • 1970-01-01
      相关资源
      最近更新 更多