com.holdenkarau.spark.testing.Prettify.scala Maven / Gradle / Ivy
The newest version!
package com.holdenkarau.spark.testing
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.{DataFrame, Dataset}
import org.scalacheck.util.Pretty
trait Prettify {
val maxNumberOfShownValues = 100
implicit def prettyDataFrame(dataframe: DataFrame): Pretty =
Pretty { _ => describeDataFrame(dataframe)}
implicit def prettyRDD(rdd: RDD[_]): Pretty =
Pretty { _ => describeRDD(rdd)}
implicit def prettyDataset(dataset: Dataset[_]): Pretty =
Pretty { _ => describeDataset(dataset)}
private def describeDataFrame(dataframe: DataFrame) =
s"""""".
stripMargin.replace("\n", " ")
private def describeRDD(rdd: RDD[_]) =
s"""""".
stripMargin.replace("\n", " ")
private def describeDataset(dataset: Dataset[_]) =
s"""""".
stripMargin.replace("\n", " ")
}
object Prettify extends Prettify