关于与HIVE表的spark结构化流式集成的一个查询.
我试图做一些火花结构流的例子.
这是我的榜样
 val spark =SparkSession.builder().appName("StatsAnalyzer")
     .enableHiveSupport()
     .config("hive.exec.dynamic.partition", "true")
     .config("hive.exec.dynamic.partition.mode", "nonstrict")
     .config("spark.sql.streaming.checkpointLocation", "hdfs://pp/apps/hive/warehouse/ab.db")
     .getOrCreate()
 // Register the dataframe as a Hive table
 val userSchema = new StructType().add("name", "string").add("age", "integer")
 val csvDF = spark.readStream.option("sep", ",").schema(userSchema).csv("file:///home/su/testdelta") 
 csvDF.createOrReplaceTempView("updates")
 val query= spark.sql("insert into table_abcd select * from updates")
 query.writeStream.start()
Run Code Online (Sandbox Code Playgroud)
正如您在将数据帧写入hdfs位置时的最后一步所看到的那样,数据未插入到令人兴奋的目录中(我的现有目录中有一些旧数据被"age"分区).
我正进入(状态
spark.sql.AnalysisException:必须使用writeStream start()执行带有流源的查询
你能帮我解释为什么我无法将数据插入到hdfs位置的现有目录中吗?或者有没有其他方法可以在蜂巢表上"插入"操作?
寻找解决方案