Skip to content

Commit e3f37c4

Browse files
authored
Simplify and increase robustness of sorting (#95)
This way, if more keyword arguments are added, they will automatically be supported
1 parent ff5da80 commit e3f37c4

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/abstractdataset/dscol.jl

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,11 @@ end
150150

151151

152152

153-
Base.Sort.defalg(col::SubOrDSCol) = Base.Sort.defalg(__!(col))
154-
function Base.sort!(col::SubOrDSCol; alg::Base.Sort.Algorithm=Base.Sort.defalg(col), lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward)
155-
sort!(__!(col), alg=alg, lt=lt, by=by, rev=rev, order=order)
153+
function Base.sort!(col::SubOrDSCol; kws...)
154+
sort!(__!(col); kws...)
156155
_modified(_attributes(parent(col.ds)))
157156
col.col index(parent(col.ds)).sortedcols && _reset_grouping_info!(parent(col.ds))
158157
col
159158
end
160-
function Base.sort(col::SubOrDSCol; alg::Base.Sort.Algorithm=Base.Sort.defalg(col), lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward)
161-
sort(__!(col), alg=alg, lt=lt, by=by, rev=rev, order=order)
162-
end
163-
164-
function Base.sortperm(col::SubOrDSCol; alg::Base.Sort.Algorithm=Base.Sort.DEFAULT_UNSTABLE, lt=isless, by=identity, rev::Bool=false, order::Base.Order.Ordering=Base.Order.Forward)
165-
sortperm(__!(col), alg=alg, lt=lt, by=by, rev=rev, order=order)
166-
end
159+
Base.sort(col::SubOrDSCol; kws...) = sort(__!(col); kws...)
160+
Base.sortperm(col::SubOrDSCol; kws...) = sortperm(__!(col); kws...)

0 commit comments

Comments
 (0)