在星火gzip的支持 [英] gzip support in Spark

查看:208
本文介绍了在星火gzip的支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于大数据项目,我打算使用火花,其中有一些不错的功能像在内存​​计算重复工作量。它可以在本地文件或HDFS上运行。

For a Big Data project, I'm planning to use spark, which has some nice features like in-memory-computations for repeated workloads. It can run on local files or on top of HDFS.

不过,官方文档中,我找不到任何提示,如何处理gzip压缩文件。在实践中,它可以是相当有效的,而不是处理。广州的解压缩文件的文件。

However, in the official documentation, I can't find any hint as to how to process gzipped files. In practice, it can be quite efficient to process .gz files instead of unzipped files.

有手动执行的gzip文件读取的方式或者已经阅读解压一个.gz的文件时自动完成?

Is there a way to manually implement reading of gzipped files or is unzipping already automatically done when reading a .gz file?

推荐答案

从星火Scala编程指南的的一节的Hadoop数据集

From the Spark Scala Programming guide's section on "Hadoop Datasets":

星火可以从存储在Hadoop分布式文件系统(HDFS)或Hadoop的(包括本地文件系统,Amazon S3的,Hypertable的,HBase的,等等)的支持其他存储系统的任何文件创建分布式数据集。火花支持文本文件,SequenceFiles,以及任何其他的Hadoop的InputFormat

Spark can create distributed datasets from any file stored in the Hadoop distributed file system (HDFS) or other storage systems supported by Hadoop (including your local file system, Amazon S3, Hypertable, HBase, etc). Spark supports text files, SequenceFiles, and any other Hadoop InputFormat.

gzip的输入文件的支持应该工作一样它在Hadoop中一样。例如, sc.textFile(myFile.gz)应自动DECOM preSS和阅读的gzip-COM pressed文件(文本文件()其实就是<一个href=\"https://github.com/mesos/spark/blob/v0.7.0/core/src/main/scala/spark/SparkContext.scala#L239\">implemented使用Hadoop的的TextInputFormat ,它支持gzip的泡沫pressed文件)。

Support for gzip input files should work the same as it does in Hadoop. For example, sc.textFile("myFile.gz") should automatically decompress and read gzip-compressed files (textFile() is actually implemented using Hadoop's TextInputFormat, which supports gzip-compressed files).

这篇关于在星火gzip的支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆