Skip to content

Commit 546868e

Browse files
committed
bug fix
1 parent caaa690 commit 546868e

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/join/compare.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function _compare(dsl, dsr, ::Val{T}; onleft, onright, cols_left, cols_right, ch
2323
res = Dataset(x1=obs_id_left, x2=obs_id_right, copycols = false)
2424
rename!(res, :x1=>Symbol(obs_id_name, "_left"), :x2=>Symbol(obs_id_name, "_right"))
2525
else
26-
res = outerjoin(dsl[!, onleft], dsr[!, onright], on = onleft .=> onright, check = check, mapformats = on_mapformats, stable = stable, alg = alg, accelerate = accelerate, method = method, threads = threads, obs_id = true, obs_id_name = obs_id_name, multiple_match = multiple_match, multiple_match_name = multiple_match_name)
26+
res = outerjoin(dsl[!, onleft], dsr[!, onright], on = 1:length(onleft) .=> 1:length(onright), check = check, mapformats = on_mapformats, stable = stable, alg = alg, accelerate = accelerate, method = method, threads = threads, obs_id = true, obs_id_name = obs_id_name, multiple_match = multiple_match, multiple_match_name = multiple_match_name)
2727
total_length = nrow(res)
2828
obs_cols = index(res)[[Symbol(obs_id_name, "_left"), Symbol(obs_id_name, "_right")]]
2929
obs_id_left = _columns(res)[obs_cols[1]]
@@ -42,7 +42,7 @@ function _compare(dsl, dsr, ::Val{T}; onleft, onright, cols_left, cols_right, ch
4242
_left_type = Core.Compiler.return_type(fl, Tuple{eltype(_columns(dsl)[cols_left[j]])})
4343
_right_type = Core.Compiler.return_type(fr, Tuple{eltype(_columns(dsr)[cols_right[j]])})
4444
_res = allocatecol(Core.Compiler.return_type(eq, Tuple{_left_type, _right_type}), total_length)
45-
45+
4646
_compare_barrier_function!(_res, _columns(dsl)[cols_left[j]], _columns(dsr)[cols_right[j]], fl, fr, eq, obs_id_left, obs_id_right, threads)
4747

4848
push!(_columns(res), _res)

test/join.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,6 +2606,8 @@ end
26062606

26072607
cmp_out = compare(ds1, ds2, cols = :z)
26082608
@test cmp_out == Dataset("z=>z" => [false, false, false, missing])
2609+
cmp_out = compare(ds1, ds2, on = [:y])
2610+
@test cmp_out == Dataset([Union{Missing, Int64}[1, 2, 1, 2, 3], Union{Missing, Int32}[1, 2, 3, 4, missing], Union{Missing, Int32}[1, 2, 1, 2, 3], Union{Missing, Bool}[false, true, false, false, missing], Union{Missing, Bool}[false, false, false, false, missing]], ["y", "obs_id_left", "obs_id_right", "x=>x", "z=>z"])
26092611
cmp_out = compare(ds1, ds2)
26102612
@test cmp_out == Dataset("x=>x" => [false, true, false, missing], "y=>y" => [true, true, false, missing], "z=>z" => [false, false, false, missing])
26112613

@@ -2712,9 +2714,3 @@ end
27122714
@test l1[:, :obs_id_left] == 1:nrow(dsl)
27132715
@test l1[:, :obs_id_right] == dsr[:, :x]
27142716
end
2715-
2716-
2717-
2718-
2719-
2720-

0 commit comments

Comments
 (0)