'Pyspark code giving wierd whitespace error

Error

When I ran this query, zip code is getting some hidden whitespace which pushes over to data-source column. Tried trim function and trim with carriage return, whitespace is not getting removed. Any suggestions?

Note: window partition was used to get zip code

select 
      distinct x, 
      first_value(zip_code) 
      over(partition by x order by date_time_closed desc) as zip_code 
from table


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source