admin管理员组文章数量:1389955
I have a Google Dataproc job that reads a CSV file from Google Cloud Storage, containing the following headers
Content-type : application/octet-stream
Content-encoding : gzip
FileName: gs://test_bucket/sample.txt (file doesn't have gz extension but it is compressed)
The below code is running successfully but the dataframe record count(9k) is not matching the file record count(100k). It looks like it is reading only the first 9k rows. How do I make sure I read all the rows into my dataframe?
self.spark :SparkSession= SparkSession.builder.appName("app_name"). \
config("spark.executor.memory","4g") \
.config("spark.hadoop.fs.gs.impl", "com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem") \
.config("spark.hadoop.google.cloud.auth.service.account.enable", "true") \
.config("spark.hadoop.fs.gs.inputstream.support.gzip.encoding.enable", "true") \
.config("spark.sql.legacy.timeParserPolicy", "CORRECTED") \
.config("spark.driver.memory","4g").getOrCreate()
df = (self.spark.read.format("csv")
.schema(schema)
.option("mode", 'PERMISSIVE')
.option("encoding", "UTF-8")
.option("columnNameOfCorruptRecord", '_corrupt_record')
.load(self.file_path) )
print("df total count: ", df.count())
本文标签: gzipParitial records being read in Pyspark through DataprocStack Overflow
版权声明:本文标题:gzip - Paritial records being read in Pyspark through Dataproc - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744602052a2615126.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论