The pure function has to be defined correctly
data = {<|"a" -> 1, "b" -> 2|>, <|"a" -> 3, "b" -> 4|>}
ds = Dataset[data];
Query
on Dataset
Query[All, {"a", "b"} /* (<|#, "f1" -> #a^2 + #b, "f2" -> N[Sin[#b + #a]]|> &)]@ds
Query
on Association
Query[All, {"a", "b"} /* (<|#, "f1" -> #a^2 + #b, "f2" -> N[Sin[#b + #a]]|> &)]@data
In both cases the Query
expression is identical
qFun = Query[All, {"a", "b"} /* (<|#, "f1" -> #a^2 + #b, "f2" -> N[Sin[#b + #a]]|> &)]
qFun@ds
qFun@data