title: is pyspark dataframe when passed as argument, passed as reference or value?
body: <p>Let's say I have this code:</p>
  <pre><code>def func1():
      # some code to create a dataframe df
      df.persist(StorageLevel.MEMORY_AND_DISK)
      return df.repartition(&quot;col1&quot;, &quot;col2&quot;)
  
  def func2(df: Dataframe):
      df = (df.select(&quot;col1&quot;, &quot;col2&quot;).groupby(&quot;col1&quot;).count().withColumnRenamed(&quot;count&quot;, &quot;count_col1&quot;))
      return df
  </code></pre>
  <p>so here in func2 when I pass the variable 'df' is it passed by reference or value? the repartition() that I am applying in func1, that should help with increasing perf when using the df in func2 right for groupBy?
  Similarly if I apply the persist() in func1, then it would be saved in memory right, an then when I refer to df in func2(), it will be referenced from the same location where it was saved only once in func1(). is that correct?</p>
  <p>Thanks!</p>