pyflink的where该如何使用?如何筛选?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

pyflink的where该如何使用?如何筛选?

洗你的头
尊敬的开发者您好:我想要在输出表中进行条件筛选,使用了where语句,结果不行
我的代码如下:
# 处理流程
t_env.from_path('mySource') \
    .select("pickup_datetime, dropoff_datetime, pickup_longitude, pickup_latitude, dropoff_longitude, dropoff_latitude, distance_meters(pickup_longitude, pickup_latitude) as O, distance_meters(dropoff_longitude, dropoff_latitude) as D, compute_duration_time(pickup_datetime, dropoff_datetime) as duration") \
&nbsp;&nbsp;&nbsp;&nbsp;.where("duration&nbsp;&gt;=&nbsp;120&nbsp;&amp;&amp;&nbsp;duration&nbsp;<=&nbsp;3600")&nbsp;\
&nbsp;&nbsp;&nbsp;&nbsp;.select("pickup_datetime,&nbsp;dropoff_datetime,&nbsp;pickup_longitude,&nbsp;pickup_latitude,&nbsp;dropoff_longitude,&nbsp;dropoff_latitude,&nbsp;O,&nbsp;D,&nbsp;is_same_od(O,&nbsp;D)&nbsp;as&nbsp;same_od,&nbsp;duration")&nbsp;\
&nbsp;&nbsp;&nbsp;&nbsp;.where("same_od&nbsp;==&nbsp;0")&nbsp;\
&nbsp;&nbsp;&nbsp;&nbsp;.select("pickup_datetime,&nbsp;dropoff_datetime,&nbsp;pickup_longitude,&nbsp;pickup_latitude,&nbsp;dropoff_longitude,&nbsp;dropoff_latitude,&nbsp;O,&nbsp;D,&nbsp;duration")&nbsp;\
&nbsp;&nbsp;&nbsp;&nbsp;.insert_into('mySink')
请问我这样使用where为什么不行呢?我应该如何去筛选出想要的结果呢?
(尝试了去掉where是可以正常运行的)