Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache spark Spark数据帧为空(无效树)_Apache Spark_Apache Spark Sql_Rdd - Fatal编程技术网

Apache spark Spark数据帧为空(无效树)

Apache spark Spark数据帧为空(无效树),apache-spark,apache-spark-sql,rdd,Apache Spark,Apache Spark Sql,Rdd,我有一个spark(spark 2.1)作业,它使用Kafka direct stream处理流数据。我用HDFS中存储的数据文件丰富了流数据。我首先读取数据文件(*.parquet)并将其存储在数据框中,然后每次使用此数据框充实一条记录 代码运行时没有出现任何错误,但没有进行扩展。我在调试模式下运行代码,发现数据帧(如df)显示为无效树。为什么rdd.foreachPartition中的数据帧为空?如何纠正这个问题?谢谢 val kafkaSinkVar = ssc.sparkContext

我有一个spark(spark 2.1)作业,它使用Kafka direct stream处理流数据。我用HDFS中存储的数据文件丰富了流数据。我首先读取数据文件(*.parquet)并将其存储在数据框中,然后每次使用此数据框充实一条记录

代码运行时没有出现任何错误,但没有进行扩展。我在调试模式下运行代码,发现数据帧(如df)显示为无效树。为什么rdd.foreachPartition中的数据帧为空?如何纠正这个问题?谢谢

 val kafkaSinkVar = ssc.sparkContext.broadcast(KafkaSink(kafkaServers, outputTopic))

 Service.aggregate(kafkaInputStream).foreachRDD(rdd => {  
      val df =ss.read.parquet( filePath + "/*.parquet" )
      println("Record Count in DF: " + df.count())  ==> the console shows the files were loaded successfully with the record count = 1300
      rdd.foreachPartition(partition => {
        val futures = partition.map(event => {
          sentMsgsNo.add(1L)
          val eventEnriched = someEnrichmen1(event,df)  ==> df is shown as invalid tree here
          kafkaSinkVar.value.sendCef(eventEnriched)
        })

        })
      })
    })