Apache spark 使用spark在表中增量存储spark流窗口的最有效方法

Apache spark 使用spark在表中增量存储spark流窗口的最有效方法,apache-spark,spark-streaming,parquet,alluxio,Apache Spark,Spark Streaming,Parquet,Alluxio,我想使用spark streaming将事件窗口插入到daily表中,同时使该表始终保持到最后一秒的最新状态 基本上,我有spark 1.4.1: val lines = KafkaUtils.createStream(ssc, zkQuorum, group, topicMap).map(_._2) lines.window(Seconds(1), Seconds(1)) .foreachRDD { (rdd, time) => if (rdd.count > 0) {

我想使用spark streaming将事件窗口插入到daily表中,同时使该表始终保持到最后一秒的最新状态

基本上,我有spark 1.4.1:

val lines = KafkaUtils.createStream(ssc, zkQuorum, group, topicMap).map(_._2)
lines.window(Seconds(1), Seconds(1))
.foreachRDD { (rdd, time) =>
  if (rdd.count > 0) {
    hiveContext.read.json(rdd).toDF().write.mode(SaveMode.Append).save(s"tachyon://192.168.1.12:19998/persistedI")
    hiveContext.sql(s"CREATE TABLE IF NOT EXISTS persistedI USING org.apache.spark.sql.parquet OPTIONS ( path 'tachyon://192.168.1.12:19998/persistedI')")
    hiveContext.sql(s"REFRESH TABLE persistedI")
  }
}
然而,随着时间的推移,这会变得越来越慢,正如我在日志中看到的,在每次插入时,前面的所有部分都会打开(我想是为了阅读拼花地板的页脚)

我尝试了以下方法,但这会使刷新速度变慢

parquet.enable.summary-metadata false spark.sql.hive.convertMetastoreParquet.mergeSchema false

对于这种情况,最好的设置是什么


(只要我能满足要求,我对所使用的东西非常灵活)

找到了解决方案吗?这个问题已经有一段时间了,目前我们使用存储为ORC的分区Hive表,它工作正常(您最终仍然需要压缩文件)找到了解决方案吗?这个问题已经有一段时间了,目前,我们使用存储为ORC的分区配置单元表,其工作状态良好(最终仍需要压缩文件)