Spark DataFrame: count distinct values of every column
<p>The question is pretty much in the title: Is there an efficient way to count the distinct values in every column in a DataFrame?</p>

<p>The <a href="https://spark.apache.org/docs/1.6.1/api/java/org/apache/spark/sql/DataFrame.html#describe(scala.collection.Seq)" rel="noreferrer">describe</a> method provides only the count but not the distinct count, and I wonder if there is a a way to get the distinct count for all (or some selected) columns.</p>