简体   繁体   English

将Spark数据帧写入现有的实木复合地板蜂巢表

[英]Write spark dataframe into existing parquet hive table

Want to write spark dataframe into existing parquet hive table. 想要将spark数据帧写入现有的镶木配置单元表中。 I am able to do it using df.write.mode("append").insertI to("myexistinghivetable") but if I check through file system I could see spark files are landed with .c000 extension. 我可以使用df.write.mode("append").insertI to("myexistinghivetable")来做到这df.write.mode("append").insertI to("myexistinghivetable")但是如果我通过文件系统检查的话,我可以看到Spark文件以.c000扩展名登陆。 What those files mean? 这些文件是什么意思? And how to write dataframe into parquet hive table. 以及如何将数据帧写入实木复合地板表中。

You can save dataframe as parquest at location where your hive table is referring after that you can alter tables in hive 您可以在配置单元表引用的位置将数据框另存为parquest,之后可以更改配置单元中的表

You can do like this 你可以这样

df.write.mode("append").parquet("HDFS directory path")

我们可以使用df.write.partitionBy("mypartitioncols").format("parquet").mode(SaveMode.Append).saveAsTable("hivetable")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM