Skip to content

Commit b171f8e

Browse files
committed
add view = false to semijoin and antijoin
1 parent 7f6cc47 commit b171f8e

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/join/main.jl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -700,9 +700,12 @@ julia> antijoin(dsl, dsr, on = :year, mapformats = true) # Use formats for datas
700700
1 │ 2012 true
701701
```
702702
"""
703-
function DataAPI.antijoin(dsl::Dataset, dsr::AbstractDataset; on = nothing, mapformats::Union{Bool, Vector{Bool}} = true, stable = false, alg = HeapSort, accelerate = false)
704-
705-
dsl[.!contains(dsl, dsr, on = on, mapformats = mapformats, stable = stable, alg = alg, accelerate = accelerate), :]
703+
function DataAPI.antijoin(dsl::Dataset, dsr::AbstractDataset; on = nothing, mapformats::Union{Bool, Vector{Bool}} = true, stable = false, alg = HeapSort, accelerate = false, view = false)
704+
if view
705+
Base.view(dsl, .!contains(dsl, dsr, on = on, mapformats = mapformats, stable = stable, alg = alg, accelerate = accelerate), :)
706+
else
707+
dsl[.!contains(dsl, dsr, on = on, mapformats = mapformats, stable = stable, alg = alg, accelerate = accelerate), :]
708+
end
706709
end
707710
"""
708711
semijoin(dsl, dsr; on=nothing, makeunique=false, mapformats=true, alg=HeapSort, stable=false)
@@ -809,8 +812,12 @@ julia> semijoin(dsl, dsr, on = :year, mapformats = true) # Use formats for datas
809812
3 │ 2020 true
810813
```
811814
"""
812-
function DataAPI.semijoin(dsl::Dataset, dsr::AbstractDataset; on = nothing, mapformats::Union{Bool, Vector{Bool}} = true, stable = false, alg = HeapSort, accelerate = false)
813-
dsl[contains(dsl, dsr, on = on, mapformats = mapformats, stable = stable, alg = alg, accelerate = accelerate), :]
815+
function DataAPI.semijoin(dsl::Dataset, dsr::AbstractDataset; on = nothing, mapformats::Union{Bool, Vector{Bool}} = true, stable = false, alg = HeapSort, accelerate = false, view = false)
816+
if view
817+
Base.view(dsl, contains(dsl, dsr, on = on, mapformats = mapformats, stable = stable, alg = alg, accelerate = accelerate), :)
818+
else
819+
dsl[contains(dsl, dsr, on = on, mapformats = mapformats, stable = stable, alg = alg, accelerate = accelerate), :]
820+
end
814821
end
815822
"""
816823
antijoin!(dsl, dsr; on=nothing, makeunique=false, mapformats=true, alg=HeapSort, stable=false)
@@ -1879,4 +1886,4 @@ julia> update(dsmain, dsupdate, on = [:group, :id], allowmissing = true, mode =
18791886
7 │ G2 2 0.0 2
18801887
```
18811888
"""
1882-
update(dsmain::Dataset, dsupdate::AbstractDataset; on = nothing, allowmissing = false, mode = :all, mapformats::Union{Bool, Vector{Bool}} = true, stable = true, alg = HeapSort, accelerate = false) = update!(copy(dsmain), dsupdate; on = on, allowmissing = allowmissing, mode = mode, mapformats = mapformats, stable = stable, alg = alg, accelerate = accelerate)
1889+
update(dsmain::AbstractDataset, dsupdate::AbstractDataset; on = nothing, allowmissing = false, mode = :all, mapformats::Union{Bool, Vector{Bool}} = true, stable = true, alg = HeapSort, accelerate = false) = update!(copy(dsmain), dsupdate; on = on, allowmissing = allowmissing, mode = mode, mapformats = mapformats, stable = stable, alg = alg, accelerate = accelerate)

0 commit comments

Comments
 (0)