'Removing white space in column values of SQL o/p

Not able to remove white space from SQL query output used in pyspark code.

I tried, trim,ltrim,rtrim,replace (multiple nested also) and regex replace. Any other suggestion.

When trim was used in sql side alone, it worked. But when it is used inside pyspark query no change



Sources

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

Source: Stack Overflow

Solution Source