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

This question is related to the answer to my previous question . Note that datetimeis a string. Therefore, I convert it to timestamp unix.

I execute this request 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: radar_id, _c1, next_radar_id, next_datetime)

Where is the mistake?

0
source share

Source: https://habr.com/ru/post/1682927/


All Articles