Skip to content

@map followed by @replacena with a function defined using a macro #328

@sswatson

Description

@sswatson

It seems that column transformation functions defined using macros can behave differently than functions defined without macros. Here's an example:

using Match, DataFrames, Query
df = DataFrame(a = [1, 2], b = [3, missing])
f(x) = @match x begin 
    3 => "three"
    _ => missing
end
df |> 
    @map({_..., c = f(_.b)}) |>
    @replacena("successfully replaced")

The output still has NAs in it, despite the final @replacena command.

If I replace f with an equivalent version without macros (even just the one obtained by expanding the macro), this works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions