Difference between Spark RDD's take(1) and first()
<p>I used to think that <code>rdd.take(1)</code> and <code>rdd.first()</code> are exactly the same. However I began to wonder if this is really true after my colleague pointed me to <a href="http://spark.apache.org/docs/latest/api/python/pyspark.html#pyspark.RDD" rel="noreferrer">Spark's officiation documentation on RDD</a>:</p>

<blockquote>
  <p><strong>first()</strong>: Return the first element in this RDD.</p>
  
  <p><strong>take(num)</strong>: Take the first num elements of the RDD.
  It works by first scanning one partition, and use the results from that partition to estimate the number of additional partitions needed to satisfy the limit.</p>
</blockquote>

<p>My questions are:</p>

<ol>
<li>Is the underlying implementation of <code>first()</code> the same as <code>take(1)</code>?</li>
<li>Suppose <code>rdd1</code> and <code>rdd2</code> are constructed from the same csv, can I safely assume that <code>rdd1.take(1)</code> and <code>rdd2.first()</code> will <strong>always</strong> return the same result, i.e., the first row of the csv? What if <code>rdd1</code> and <code>rdd2</code> are partitioned differently? </li>
</ol>