title: writing dataframe to parquet files failes with empty or nested empty schemas
body: <p>I 'm pretty new to  both scala and spark. I have a very dumb question. I have a dataframe that I created from elasticsearch. I'm trying to write that s3 in parquet format. below is my code block and error i'm seeing. Can a good samaritan please undumb me on this one?</p>
  
  <pre><code>      val dfSchema = dataFrame.schema.json
  //      log.info(dfSchema)
        dataFrame
          .withColumn("lastFound", functions.date_add(dataFrame.col("last_found"), -457))
          .write
          .partitionBy("lastFound")
          .mode("append")
          .format("parquet")
          .option("schema", dfSchema)
          .save("/tmp/elasticsearch/")
  </code></pre>
  
  <pre><code>org.apache.spark.sql.AnalysisException: 
  Datasource does not support writing empty or nested empty schemas.
  Please make sure the data schema has at least one or more column(s).
           ;
      at org.apache.spark.sql.execution.datasources.DataSource$.org$apache$spark$sql$execution$datasources$DataSource$$validateSchema(DataSource.scala:733)
      at org.apache.spark.sql.execution.datasources.DataSource.planForWriting(DataSource.scala:523)
      at org.apache.spark.sql.DataFrameWriter.saveToV1Source(DataFrameWriter.scala:290)
      at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:271)
      at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:229)
  </code></pre>