def valid_pcd(pcd, client_date):
"""Determine if the profile creation date column is valid given the date
reported by the client."""
pcd_format = F.date_format(pcd, 'yyyy-MM-dd')
is_valid_pcd = [
pcd_format.isNotNull(),
(pcd_format > DEFAULT_DATE),
(pcd <= client_date),
]
return (
F.when(reduce(operator.__and__, is_valid_pcd), pcd)
.otherwise(F.lit(None))
)
评论列表
文章目录