title: Unable to resolve Column Name Spark
body: <p>I have created 2 dataframe as below: </p>
  
  <pre><code>df_flights = spark1.read.parquet('domestic-flights\\flights.parquet')
  df_airport_codes = spark1.read.load('domestic-flights\\flights.csv',format="csv",sep=",",inferSchema=True,header=True)
  </code></pre>
  
  <p>I then referenced the databricks guide to not get duplicate columns <a href="https://docs.databricks.com/spark/latest/faq/join-two-dataframes-duplicated-column.html" rel="nofollow noreferrer">https://docs.databricks.com/spark/latest/faq/join-two-dataframes-duplicated-column.html</a> </p>
  
  <pre><code>df3=df_flights.join(df_airport_codes,"origin_airport_code", 'left')
  </code></pre>
  
  <p>When I try to sort by any of the columns which were in both dataframes I am still getting the same error</p>
  
  <pre><code>Py4JJavaError: An error occurred while calling o1553.filter.
  </code></pre>
  
  <p>: org.apache.spark.sql.AnalysisException: Reference 'passengers' is ambiguous, could be: passengers, passengers.;</p>
  
  <p>OR if I attempt a sort:</p>
  
  <pre><code>df3.sort('passengers')
  
  Py4JJavaError: An error occurred while calling o1553.sort.: org.apache.spark.sql.AnalysisException: cannot resolve '`passengers`' given input columns: [flights, destination_population, origin_city, distance, passengers, seats, flights, origin_population, passengers, flight_datetime, origin_air_port_code, flight_year, seats, origin_city, destination_city, destination_city, destination_airport_code, destination_airport_code, origin_population, destination_population, flight_month, distance];;
  </code></pre>
  
  <p>The question is, is there an error with my join logic? If not, how do I alias the ambiguous column? </p>