cache tables in apache spark sql
<p>From the Spark official <a href="http://spark.apache.org/docs/latest/sql-programming-guide.html#caching-data-in-memory" rel="noreferrer">document</a>, it says:</p>

<blockquote>
  <p>Spark SQL can cache tables using an in-memory columnar format by
  calling sqlContext.cacheTable("tableName") or dataFrame.cache(). Then
  Spark SQL will scan only required columns and will automatically tune
  compression to minimize memory usage and GC pressure. You can call
  sqlContext.uncacheTable("tableName") to remove the table from memory.</p>
</blockquote>

<p>What does caching tables using a in-memory columnar format really mean?
Put the whole table into the memory? As we know that cache is also lazy,
the table is cached after the first action on the query. Does it make any difference to the cached table if choosing different actions or queries? I've googled this cache topic several times but failed to find some detailed articles. I would really appreciate it if anyone can provides some links or articles for this topic.</p>

<p><a href="http://spark.apache.org/docs/latest/sql-programming-guide.html#caching-data-in-memory" rel="noreferrer">http://spark.apache.org/docs/latest/sql-programming-guide.html#caching-data-in-memory</a></p>