public UtilTable(@NonNull final Class<T> type, @NonNull final JavaRDD<T> javaRDD, @NonNull final Path destPath, final boolean isDatePartitioned, @NonNull final SparkSession sparkSession) { this.spark = sparkSession; final RDD<T> rdd = javaRDD.rdd(); final Encoder<T> bean = Encoders.bean(type); this.dataset = this.spark.createDataset(rdd, bean); this.destPath = destPath; this.isDatePartitioned = isDatePartitioned; }