Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix broadcasting 380 #382

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading