JuliaData / IndexedTables.jl

Flexible tables with ordered indices
https://juliadb.org
MIT License
121 stars 37 forks source link

Fix newname => selector pairs #281

Closed akdor1154 closed 4 years ago

akdor1154 commented 4 years ago

This should fix #279 , that is, make select(tbl, (:newname => :existing,)) work.

One note is that it's now not possible to to select :col => mapfn when !(mapFn isa Function). I don't think it's possible to resolve this succinctly/with dispatch (see: https://discourse.julialang.org/t/functions-and-callable-methods/2983). A workaround for users using functors like this would be select(tbl, (mapFn.(tbl.columns.col),)).

If the above is not acceptable, then alternatively I could special-case the selector Pair{Symbol, Union{Symbol, Int, String, AbstractArray}}, but this seems less general that ideal.

joshday commented 4 years ago

Thanks! I'll blame GitHub's new notification system for missing this.

akdor1154 commented 4 years ago

no worries haha. Added your change (thanks!), checked tests still pass, and squashed (left the overload commit separate on purpose for imo clearer history).

joshday commented 4 years ago

Thanks again!