首页 > 解决方案 > Scala - 将数据帧作为二进制文件写入文件

问题描述

我有一个镶木地板类型的蜂巢表,列Content存储各种文档为 base64 编码。

现在,我需要读取该列并将其写入 HDFS 中的文件,以便将 base64 列转换回每一行的文档。

val profileDF = sqlContext.read.parquet("/hdfspath/profiles/");
profileDF.registerTempTable("profiles")
val contentsDF = sqlContext.sql(" select unbase64(contents) as contents from profiles where file_name'file1'")

现在contentDF将文档的二进制格式存储为一行,我需要将其写入文件。尝试了不同的选项,但无法将数据框内容恢复到文件中。

感谢您对此的任何帮助。

标签: scalaapache-spark

解决方案



推荐阅读