Skip to content

Instantly share code, notes, and snippets.

@64lines
Last active February 19, 2019 20:02
Show Gist options
  • Save 64lines/4c1b455088a7395071028f803c209258 to your computer and use it in GitHub Desktop.
Save 64lines/4c1b455088a7395071028f803c209258 to your computer and use it in GitHub Desktop.
from pyspark.sql.functions import *
# Example 1
fact_df = fact_df.withColumn('colname', trim(col('colname'))).alias('fact_df')
# Example 2
fact_df = fact_df.join(dimension_df, trim(col('fact_df.colname') == trim(col('dimension_df.another_colname')), 'left').alias('fact_df')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment