title: join in a dataframe spark java
body: <p>First of all, thank you for the time in reading my question.</p>
  
  <p>My question is the following: In Spark with Java, i load in two dataframe the data of two csv files.</p>
  
  <p>These dataframes will have the following information.</p>
  
  <p>Dataframe Airport</p>
  
  <pre><code>Id | Name    | City
  -----------------------
  1  | Barajas | Madrid
  </code></pre>
  
  <p>Dataframe airport_city_state</p>
  
  <pre><code>City | state
  ----------------
  Madrid | España
  </code></pre>
  
  <p>I want to join these two dataframes so that it looks like this:</p>
  
  <p>dataframe result</p>
  
  <pre><code>Id | Name    | City   | state
  --------------------------
  1  | Barajas | Madrid | España
  </code></pre>
  
  <p>Where <code>dfairport.city = dfaiport_city_state.city</code></p>
  
  <p>But I can not clarify with the syntax so I can do the join correctly. A little code of how I have created the variables:</p>
  
  <pre><code> // Load the csv, you have to specify that you have header and what delimiter you have
  Dataset &lt;Row&gt; dfairport = Load.Csv (sqlContext, data_airport);
  Dataset &lt;Row&gt; dfairport_city_state = Load.Csv (sqlContext,   data_airport_city_state);
  
  
  // Change the name of the columns in the csv dataframe to match the columns in the database
  // Once they match the name we can insert them
  Dfairport
  .withColumnRenamed ("leg_key", "id")
  .withColumnRenamed ("leg_name", "name")
  .withColumnRenamed ("leg_city", "city")
  
  dfairport_city_state
  .withColumnRenamed("city", "ciudad")
  .withColumnRenamed("state", "estado");
  </code></pre>