Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differences from StructArrays #106

Open
aplavin opened this issue Nov 24, 2022 · 3 comments
Open

Differences from StructArrays #106

aplavin opened this issue Nov 24, 2022 · 3 comments

Comments

@aplavin
Copy link

aplavin commented Nov 24, 2022

The interface seems very similar to a StructArray, so I wonder what are the main differences. Are they highlighted somewhere?
A cursory look suggests that a Table and a StructArray are basically drop-in replacements for each other.

@sairus7
Copy link

sairus7 commented Jan 20, 2023

I'm asking myself the same question.
StructArray also has a richer functionality, since it can wrap not only NamedTuples but custom structs as well.

@andyferris
Copy link
Member

andyferris commented Jan 21, 2023

Historically, TypedTables came just before StructArrays, and they have a lot in common. I'd say TypedTables comes from "dataframes in Julia should just be a strongly typed AbstractVector" and StructArrays implements a struct-of-arrays (SoA) to array-of-structs (AoS) wrapper type, which end up being somewhat equivalent ideas.

StructArray also has a richer functionality, since it can wrap not only NamedTuples but custom structs as well.

One difference that manifests from this viewpoint is in data systems (like, say, SQL) a row (element in a relation) is just a named tuple (and is structurally typed), whereas the SoA-AoS transformation naturally is useful for arbitrary Julia structs (which are nominally typed), which explains this distinction.

@aplavin
Copy link
Author

aplavin commented Jan 23, 2023

@andyferris is there any functionality in TypedTables.Table not provided by StructArrays? Ie in what circumstances one should use the former?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants