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

Suggestion: relax type annotation on dict2columns #36

Open
kpa28-git opened this issue Jan 22, 2024 · 0 comments
Open

Suggestion: relax type annotation on dict2columns #36

kpa28-git opened this issue Jan 22, 2024 · 0 comments

Comments

@kpa28-git
Copy link

I like using StructArrays.jl for data manipulation. Converting a StructVector to a NamedTuple is basically free because of how StructArray is implemented. There are a number of Tables.jl types that work like this.

I wonder if we could relax the data input type annotation on dict2columns? This would allow us to insert iterators of anything that validly implements Base.keys and Base.pairs (e.g. NamedTuple).

I tried this change to src/Query.jl and it doesn't break any existing test cases:

function dict2columns(
-    dict::Dict{Symbol, T} where T,
+    dict,
    valid_columns::Dict{Symbol, String},
)::Vector{Column}

...

      [
          Column(string(name), valid_columns[name], column)
-        for (name, column) ∈ dict
+        for (name, column) ∈ pairs(dict)
      ]
end

Maybe a simple stopgap until Tables.jl integration.

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

1 participant