title: Spark save dataframe metadata and reuse it
body: <p>When I read a dataset with a lot of files (in my case from google cloud storage), <code>spark.read</code> works a lot of time before the first manipulation.
  I'm not sure what it does but I guess it maps the files and sample them to infer the schema.</p>
  
  <p>My question is, is there an option to save this metadata collected about the dataframe and reuse it in other work on the dataset.</p>
  
  <p>-- UPDATE --</p>
  
  <p>The data is arranged like this: </p>
  
  <blockquote>
    <p>gs://bucket-name/table_name/day=yyyymmdd/many_json_files</p>
  </blockquote>
  
  <p>When I run: <code>df = spark.read.json("gs://bucket-name/table_name")</code> That's take a lot of time. I wish I could do the following: </p>
  
  <pre><code>df = spark.read.json("gs://bucket-name/table_name") 
  df.saveMetadata("gs://bucket-name/table_name_metadata") 
  </code></pre>
  
  <p>And in another session: </p>
  
  <pre><code>df = spark.read.metadata("gs://bucket-name/table_name_metadata").‌​json("gs://bucket-na‌​me/table_name") 
  ... 
  &lt;some df manipulation&gt; 
  ...
  </code></pre>