title: Is Spark 3.1.2 smart enough to reorder joins?
body: <p>consider I have three dataframes:</p>
  <ul>
  <li>index_df: (x, y, metadata)</li>
  <li>f1_df: (x, y, f1)</li>
  <li>f2_df: (x, y, f2)</li>
  </ul>
  <p>Now I join dataframes in the following order:</p>
  <pre class="lang-py prettyprint-override"><code>index_df.join(
      f1_df.join(f2_df, on=[&quot;x&quot;, &quot;y&quot;], how=&quot;outer&quot;),
      on=[&quot;x&quot;, &quot;y&quot;],
      how=&quot;left&quot;
  )
  </code></pre>
  <p>Is PySpark smart enough to reorder this to a sequence of left-joins?</p>
  <pre class="lang-py prettyprint-override"><code>index_df.join(
      f1_df,
      on=[&quot;x&quot;, &quot;y&quot;],
      how=&quot;left&quot;
  ).join(
      f2_df,
      on=[&quot;x&quot;, &quot;y&quot;],
      how=&quot;left&quot;
  )
  </code></pre>
  <p>Outer joins might be very expensive and are not necessary here.</p>