Skip to content

Commit

Permalink
bugfix broadcasting 380 (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdeffebach authored Mar 1, 2024
1 parent 85f104b commit 28bfa4d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/parsing_astable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function replace_syms_astable!(inputs_to_function::AbstractDict,
return e.args[2]
end

println(e)
col = get_column_expr(e)
if col !== nothing
return conditionally_add_symbols!(inputs_to_function, lhs_assignments, col)
Expand All @@ -35,7 +36,7 @@ protect_replace_syms_astable!(inputs_to_function::AbstractDict,
lhs_assignments::OrderedCollections.OrderedDict, e) = e
protect_replace_syms_astable!(inputs_to_function::AbstractDict,
lhs_assignments::OrderedCollections.OrderedDict, e::Expr) =
replace_syms!(inputs_to_function, lhs_assignments, e)
replace_syms_astable!(inputs_to_function, lhs_assignments, e)

function replace_dotted_astable!(inputs_to_function::AbstractDict,
lhs_assignments::OrderedCollections.OrderedDict, e)
Expand Down
14 changes: 14 additions & 0 deletions test/astable_flag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,18 @@ end
@test_throws ArgumentError @eval @transform df @astable cols(AsTable) = :y
end

@testset "Broadcasting bugfix #380" begin
df = DataFrame(x=["a","b"], y = [1, 2], z = [3, 4])
@transform df @astable :a = string.(:x, "c")
@transform df @astable :a = :y .+ :z
@transform df @astable :a = (+).(:y, :z)
@select df @astable begin
:a = string.(:x, "c")
:b = string.(:x, :y)
:c = string.(:x, $"y")
:d = :y .+ :z
:e = (+).(:y, :z)
end
end

end # module

0 comments on commit 28bfa4d

Please sign in to comment.