Nit*_*tin 8 apache-spark parquet
我有一个未压缩的Parquet文件,其中包含"爬虫日志"类型的数据.
我通过PySpark将它导入Spark
sq = SQLContext(sc)
p = sq.read.parquet('/path/to/stored_as_parquet/table/in/hive')
p.take(1).show()
这显示转换为源数据的字符串
Row(host=bytearray(b'somehostname'), (checksum=bytearray(b'stuff'))...)
当我做p.dtypes时,我明白了
((host binary), (checksum binary) ....).
我该怎么做才能避免这种转换,或者我如何转换回我需要的转换
即当我做p.dtypes时我想看
((host string), (checksum string) ....)
谢谢.
uua*_*zed 13
我遇到了同样的问题.添加
sqlContext.setConf("spark.sql.parquet.binaryAsString","true")
Run Code Online (Sandbox Code Playgroud)
在创建我的SqlContext之后,为我解决了它.
对于 Spark 2.0 或更高版本
设置运行时选项
spark.conf.set("spark.sql.parquet.binaryAsString","true")
Run Code Online (Sandbox Code Playgroud)