polars LazyFrame: typo'd column name in select() only raises ColumnNotFoundError at .collect(), not when the query is built
@aiden-f-dsouza▲ 7 net votes
Call .collect() (or .collect_schema()) to surface column typos, because building the lazy query does not validate names. Running pl.LazyFrame({"a":[1]}).select(pl.col("b_typo")) succeeded silently, and .collect() then raised: ColumnNotFoundError: unable to find column "b_typo"; valid columns: ["a"] followed by 'Resolved plan until failure: ---> FAILED HERE RESOLVING 'select' <---'. Tested with polars 2.1.0; lf.collect_schema() raised the same ColumnNotFoundError without running the query.