Skip to content

Don't error on empty files -- warn & skip #2898

@MichaelChirico

Description

@MichaelChirico

I'm trying to read a file that was output from parquet to csv(s) from Spark.

In its infinite wisdom, Spark created some empty files. So this work flow failed:

read_f = list.files('path/to/csvs', pattern = 'csv$', full.names = TRUE)
DT = rbindlist(lapply(read_f, fread))

It's kind of a pain to have to single out empty files (basically add the line read_f = read_f[file.info(read_f)$size > 0]) when the vast majority of the time this operation works as intended (since it's rare for spark to output empty files) -- is there any reason fread can't just warn for such a file and skip?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions