title: sparklyr- is calling print or glimpse on a spark data frame an expensive operation? how is it performed?
body: <p>I'm trying to understand the lazy evaluation in <code>sparklyr</code> and have found some behaviour which I'm not sure is intended. </p>
  
  <p>I have a large table with 10 billion rows called 'records', let's say. </p>
  
  <pre><code>dat &lt;- tbl(sc, 'records') 
  </code></pre>
  
  <p>What exactly happens under the hood when I type the following commands:</p>
  
  <pre><code>dat
  print (dat) 
  glimpse(dat) 
  </code></pre>
  
  <p>I would have expected, since none of these commands actually return information about the full number of rows, that there to be a clever method that only gathers ten or so rows and prints those. I would also expect this to be super fast as well and generally independent of the size of the table. </p>
  
  <p>When I actually run these commands on my large table, it pretty much just does nothing. After monitoring the back end a bit, it appears that spark is trying to gather the entire table together. 
  When I do the same thing on smaller tables with, say, only 10 000 rows. the result of the above commands will take about a minute or so. </p>
  
  <p>I find this behaviour surprising - is there some documentation that I am missing? Am I thinking about this the wrong way or is my set up wrongly configured?</p>
  
  <p>Thanks, any help/guidance is much appreciated. </p>