Skip to content

Resolve the schema of this LazyFrame

Description

This resolves the query plan but does not trigger computations.

Usage

<LazyFrame>$collect_schema()

Value

A named list with names indicating column names and values indicating column data types.

Examples

library("polars")

lf <- pl$LazyFrame(
  foo = 1:3,
  bar = 6:8,
  ham = c("a", "b", "c")
)

lf$collect_schema()
#> $foo
#> Int32
#> 
#> $bar
#> Int32
#> 
#> $ham
#> String
lf$with_columns(
  baz = (pl$col("foo") + pl$col("bar"))$cast(pl$String),
  pl$col("bar")$cast(pl$Int64)
)$collect_schema()
#> $foo
#> Int32
#> 
#> $bar
#> Int64
#> 
#> $ham
#> String
#> 
#> $baz
#> String