You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "pin_zhang (JIRA)" <ji...@apache.org> on 2017/06/15 08:21:00 UTC

[jira] [Created] (SPARK-21105) Useless empty files in hive table

pin_zhang created SPARK-21105:
---------------------------------

             Summary: Useless empty files in hive table
                 Key: SPARK-21105
                 URL: https://issues.apache.org/jira/browse/SPARK-21105
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 2.0.1
            Reporter: pin_zhang


case class Base(v: Option[Double])
object EmptyFiles {
  
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setAppName("scala").setMaster("local[12]")
    val ctx = new SparkContext(conf)
    val spark = SparkSession.builder().enableHiveSupport().config(conf).getOrCreate()
    val seq = Seq(Base(Some(1D)), Base(Some(1D)));
    val rdd = ctx.makeRDD[Base](seq)
    import spark.implicits._
    rdd.toDS().write.format("json").mode(SaveMode.Append).saveAsTable("EmptyFiles")
  }
}

// DataSet create many useless empty files for empty partition
// if insert  small RDD into the table many times, which result in too many empty files, which slow down the query.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org