简体   繁体   English

apache spark streaming textFileStream-读取gzip文件

[英]apache spark Streaming textFileStream - reading gzip files

I am processing files placed in HDFS using Spark streaming. 我正在使用Spark流处理放置在HDFS中的文件。 Specifically using textFileStream method of the JavaStreamingContext class. 特别是使用JavaStreamingContext类的textFileStream方法。

As the method name contains 'text' I assumed that this will only read text files, but to my surprise it is also reading gzipped text files. 由于方法名称包含“文本”,因此我认为这只会读取文本文件,但令我惊讶的是,它也读取了压缩的文本文件。

Can anyone please clarify if this is the expected behavior and what all formats can it read? 任何人都可以澄清这是否是预期的行为以及它可以读取所有格式吗?

Yes, Spark uses Hadoop's File I/O API, which handles compression formats transparently. 是的,Spark使用Hadoop的File I / O API,该API透明地处理压缩格式。 Even for output, you can configure the compression that should be used through a property setting and the API will handle it. 即使对于输出,您也可以配置应通过属性设置使用的压缩方式,API会对其进行处理。

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

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