Skip to content

Commit 4f2b4bf

Browse files
authored
fix: Expose the schema argument of <expr>$meta$pop()
1 parent 955cd80 commit 4f2b4bf

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

R/expr-meta.R

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,28 @@ expr_meta_is_regex_projection <- function() {
289289
#' Pop the latest expression and return the input(s) of the popped expression
290290
#'
291291
#' @inherit as_polars_expr return
292+
#' @inheritParams rlang::args_dots_empty
293+
#' @param schema An optional schema. Must be `NULL` or a named list of
294+
#' [DataType].
292295
#' @examples
293296
#' e <- pl$col("foo") + pl$col("bar")
294297
#' first <- e$meta$pop()[[1]]
295298
#'
296299
#' first$meta$eq(pl$col("bar"))
297300
#' first$meta$eq(pl$col("foo"))
298-
expr_meta_pop <- function() {
299-
lapply(self$`_rexpr`$meta_pop(), \(ptr) {
300-
.savvy_wrap_PlRExpr(ptr) |>
301-
wrap()
301+
expr_meta_pop <- function(..., schema = NULL) {
302+
wrap({
303+
check_dots_empty0(...)
304+
check_list_of_polars_dtype(schema, allow_null = TRUE)
305+
306+
if (!is.null(schema)) {
307+
schema <- parse_into_list_of_datatypes(!!!schema)
308+
}
309+
310+
self$`_rexpr`$meta_pop(schema = schema) |>
311+
lapply(\(ptr) {
312+
.savvy_wrap_PlRExpr(ptr) |>
313+
wrap()
314+
})
302315
})
303316
}

man/expr_meta_pop.Rd

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)