简体   繁体   English

PySpark where 子句条件条件

[英]PySpark where clause condition on condition

I'm getting Syntax error on below query:我在以下查询中收到语法错误:

df_result = df_checkout.join(df_checkin, 
                                    (
                                    (df_checkout.product == df_checkin.product)
                                    (df_checkout.host == df_checkin.host)
                                    ),
                                    how = 'full_outer').where(df_checkout.rank = 
                                        F.when(((df_checkout.rank = df_checkin.rank) and (F.unix_timestamp(df_checkout.checkout_date, 'MM/dd/YYYY HH:MI:SS') <= F.unix_timestamp(df_checkin.checkin_date, 'MM/dd/YYYY HH:MI:SS'))), (df_checkin.rank - 1)).when(((df_checkout.rank = df_checkin.rank) and (F.unix_timestamp(df_checkout.checkout_date, 'MM/dd/YYYY HH:MI:SS') >= F.unix_timestamp(df_checkin.checkin_date, 'MM/dd/YYYY HH:MI:SS'))), df_checkin.rank).otherwise(None)
                                    )

What is the error I'm having ?我遇到了什么错误?

you have a = instead of == :你有一个=而不是==

(df_checkout.rank = df_checkin.rank)

should be应该

(df_checkout.rank == df_checkin.rank)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM