Live data from Hacker News

Why isn’t there a decent file format for tabular data?

successfulsoftware.net

141–150 of 355 posts

Re: Why isn’t there a decent file format for tabular data?

#141
post #128

I think CSV is a decent file format for tabular data. The author claims that CSV files are > difficult to parse efficiently using multiple cores, due to the quoting (you can’t start parsing from part way through a file). But I do not see why this is the case. Step 1: loop over file (in parallel) to determine indices of quote characters Step 2: loop over indices outside quote regions (in parallel) to determine indices…

[deleted]

Re: Why isn’t there a decent file format for tabular data?

#142

I never understood why the ASCII separator characters aren't used more. It seems like we're one simple text editor feature away from having easy display and modification. Is there some historical reason for not doing that?

Because they don't have standardized escaping, and when you are rolling your own ad-hoc escaping scheme you can just use printable separator anyway.

Re: Why isn’t there a decent file format for tabular data?

#143
post #128

I think CSV is a decent file format for tabular data. The author claims that CSV files are > difficult to parse efficiently using multiple cores, due to the quoting (you can’t start parsing from part way through a file). But I do not see why this is the case. Step 1: loop over file (in parallel) to determine indices of quote characters Step 2: loop over indices outside quote regions (in parallel) to determine indices…

I'm inclined to agree. CSVs which are well-formed (escapes within fields handled consistently) shouldn't be that hard to parse.

I can't think of a reason your algo wouldn't be logically sound for good CSV files, although a little backtracking might be necessary to recognize escaping of delimiters in edge cases.

The author writes "CSV is a mess. One quote in the wrong place and the file is invalid.", but what logical formats can tolerate arbitrary corruption? An unclosed tag is similarly problematic for xml. In both cases you wind up falling back to heuristics.

It's true that CSVs often contain a mess of encodings inside fields, but that's not the problem of the CSV format per se. Validation of field encodings, or validation that the entire file is in a uniform encoding... those are separate requirements.

Re: Why isn’t there a decent file format for tabular data?

#144

Parquet is a wonderful file format and is a dream to work with compared to CSV. Parquet embeds the schema in the footer metadata, so the query engines don't need to guess what the column names / data types are. Parquet used to be poorly supported, but now it's well supported by almost all languages. You can even view Parquet files in text editors now, but that's not something I've ever needed ( https://blog.jetbrains…

I've been pretty impressed with parquet lately. One thing I've missed is a way to group tables. Is there a standard for that? While parquet is generally column oriented it has support for metadata about tables of multiple columns. However, I'm not aware of any format that groups the tables , short of just zipping a bunch of files. For context, this would be for an application that passes sqlite files around. So natur…

You want to search for “DataFrame” libraries.

Another commenter mentioned Spark, Panda’s is another popular one, not used it but think it’s lighter weight where Spark is more for large distributed computation even though can run locally.

There’s a bunch of these tools which lets you treat parquet files as tables doing joins, aggregations etc.

Re: Why isn’t there a decent file format for tabular data?

#145

Seems like the problem here is there is several high quality and well-developed formats, but the author and the commenters here dismiss them because of the different trade-offs they make. csv -- Simple for simple use cases, text-based, however many edge cases, feature lacking etc xlsx -- Works in excel, ubiquitous format with a standard, however complicated and missing scientific features sqlite -- Designed for relat…

None of them seem all that conducive to source control or merging. Any good format for that?

Re: Why isn’t there a decent file format for tabular data?

#146
post #145

Seems like the problem here is there is several high quality and well-developed formats, but the author and the commenters here dismiss them because of the different trade-offs they make. csv -- Simple for simple use cases, text-based, however many edge cases, feature lacking etc xlsx -- Works in excel, ubiquitous format with a standard, however complicated and missing scientific features sqlite -- Designed for relat…

None of them seem all that conducive to source control or merging. Any good format for that?

Don't put data in source control; use a database.

Re: Why isn’t there a decent file format for tabular data?

#147

Parquet is a wonderful file format and is a dream to work with compared to CSV. Parquet embeds the schema in the footer metadata, so the query engines don't need to guess what the column names / data types are. Parquet used to be poorly supported, but now it's well supported by almost all languages. You can even view Parquet files in text editors now, but that's not something I've ever needed ( https://blog.jetbrains…

It's it possible to diff a parquet file?

Re: Why isn’t there a decent file format for tabular data?

#149
post #145

Seems like the problem here is there is several high quality and well-developed formats, but the author and the commenters here dismiss them because of the different trade-offs they make. csv -- Simple for simple use cases, text-based, however many edge cases, feature lacking etc xlsx -- Works in excel, ubiquitous format with a standard, however complicated and missing scientific features sqlite -- Designed for relat…

None of them seem all that conducive to source control or merging. Any good format for that?

CSV should be pretty easy to merge, given that it’s line based.

Re: Why isn’t there a decent file format for tabular data?

#150

Seems like the problem here is there is several high quality and well-developed formats, but the author and the commenters here dismiss them because of the different trade-offs they make. csv -- Simple for simple use cases, text-based, however many edge cases, feature lacking etc xlsx -- Works in excel, ubiquitous format with a standard, however complicated and missing scientific features sqlite -- Designed for relat…

The latest version of SQLite has a STRICT command to enforce the data types. This option is set per table, but even in a STRICT table you can specify the type of some columns as ANY if you want to allow any type of data in that column (this is not the same meaning of ANY in non-strict tables).

You are limited to the basic types (int, floating point, string, and blob), however. I can somewhat get behind the opinionated argument for not needing more specific types like most common language types, but not the lack of a date type.
Post reply on HN