SemanticException [Error 10004]: Line 11:18 Invalid table alias or column reference

强颜欢笑 提交于 2019-12-12 04:37:55

问题


This question is related to the answer of my previous question. Please notice that datetime is string. Therefore I convert it to unix timestamp.

I execute this query in Hive 1.2.1:

select count(*) / count(distinct to_date(datetime)) as trips_per_day 

from (select radar_id,to_unix_timestamp(datetime),lead(radar_id) over w as 
      next_radar_id,lead(to_unix_timestamp(datetime)) over w as 
      next_datetime 
      from mytable 
      where radar_id in ('A21','B15') window w as 
     (partition by car_id order by to_unix_timestamp(datetime))) t 

where radar_id = 'A21' and next_radar_id = 'B15' 
      and to_unix_timestamp(datetime) + 30*60 > to_unix_timestamp(next_datetime);

But I get the following error:

SemanticException [Error 10004]: Line 11:18 Invalid table alias or column reference 'datetime': (possible column names are: radar_id, _c1, next_radar_id, next_datetime)

Where is an error?

来源:https://stackoverflow.com/questions/45486630/semanticexception-error-10004-line-1118-invalid-table-alias-or-column-refere

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!