Skip to content

Suggestion: relax type annotation on dict2columns #36

@kpa28-git

Description

@kpa28-git

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions