You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
polars.exceptions.ComputeError: column 'records' not available in schema Schema:
name: x, data type: Int64
Issue description
Originally came across this when running a long lazy query that led to a panic pyo3_runtime.PanicException: called Result::unwrap()on anErr value: ColumnNotFound(ErrString("records")). When reducing to the provided MRE, the error instead becomes a ComputeError.
This is the panic backtrace of the original query, but it's likely the issue happens much earlier from where the panic happens. The records column is created via .select(records=pl.count()) (in a similar fashion to the one in the MRE):
Panic backtrace
thread '<unnamed>' panicked at /home/runner/work/polars/polars/crates/polars-plan/src/utils.rs:384:68:
called `Result::unwrap()` on an `Err` value:ColumnNotFound(ErrString("records"))
stack backtrace:0: rust_begin_unwind
at /rustc/475c71da0710fd1d40c046f9cee04b733b5b2b51/library/std/src/panicking.rs:597:51: core::panicking::panic_fmt
at /rustc/475c71da0710fd1d40c046f9cee04b733b5b2b51/library/core/src/panicking.rs:72:142: core::result::unwrap_failed
at /rustc/475c71da0710fd1d40c046f9cee04b733b5b2b51/library/core/src/result.rs:1653:53: polars_plan::utils::aexprs_to_schema4: polars_plan::logical_plan::builder_alp::ALogicalPlanBuilder::project5: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down6: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign7: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down8: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign9: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down10: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign11: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down12: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign13: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down14: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign15: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down16: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign17: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down18: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign19: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down20: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign21: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down22: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign23: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down24: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign25: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down26: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign27: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down28: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign29: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down30: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign31: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down32: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign33: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down34: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign35: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down36: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign37: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down38: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::pushdown_and_assign39: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down40: core::iter::adapters::map::map_try_fold::{{closure}}41: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::no_pushdown_restart_opt42: polars_plan::logical_plan::optimizer::projection_pushdown::functions::melt::process_melt43: polars_plan::logical_plan::optimizer::projection_pushdown::ProjectionPushDown::push_down44: polars_plan::logical_plan::optimizer::optimize45: polars_lazy::frame::LazyFrame::optimize_with_scratch46: polars_lazy::frame::LazyFrame::prepare_collect47: polars_lazy::frame::LazyFrame::collect48: polars::lazyframe::_::<impl polars::lazyframe::PyLazyFrame>::__pymethod_collect__49: pyo3::impl_::trampoline::trampoline50: _PyEval_EvalFrameDefault
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Python/ceval.c:5284:2951: _PyEval_EvalFrame
at /tmp/python-build.20231011043018.472516/Python-3.11.6/./Include/internal/pycore_ceval.h:73:1652: _PyEval_Vector
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Python/ceval.c:6425:2453: _PyVectorcall_Call
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Objects/call.c:245:1654: _PyObject_Call
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Objects/call.c:328:1655: do_call_core
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Python/ceval.c:7343:1256: _PyEval_EvalFrameDefault
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Python/ceval.c:5367:2257: _PyEval_EvalFrame
at /tmp/python-build.20231011043018.472516/Python-3.11.6/./Include/internal/pycore_ceval.h:73:1658: _PyEval_Vector
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Python/ceval.c:6425:2459:PyEval_EvalCode
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Python/ceval.c:1140:2160: run_eval_code_obj
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Python/pythonrun.c:1710:961: run_mod
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Python/pythonrun.c:1731:1962: pyrun_file
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Python/pythonrun.c:1626:1563: _PyRun_SimpleFileObject
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Python/pythonrun.c:440:1364: _PyRun_AnyFileObject
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Python/pythonrun.c:79:1565: pymain_run_file_obj
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Modules/main.c:360:1566: pymain_run_file
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Modules/main.c:379:1567: pymain_run_python
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Modules/main.c:601:2168:Py_RunMain
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Modules/main.c:680:569: pymain_main
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Modules/main.c:710:1270:Py_BytesMain
at /tmp/python-build.20231011043018.472516/Python-3.11.6/Modules/main.c:734:1271: __libc_start_main
72: _start
note:Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
...
pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value:ColumnNotFound(ErrString("records"))
Expected behavior
The MRE should provide the following output instead of erroring (it works if projection_pushdown is set to False):
Checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
Reproducible example
Log output
Issue description
Originally came across this when running a long lazy query that led to a panic
pyo3_runtime.PanicException: called
Result::unwrap()on an
Errvalue: ColumnNotFound(ErrString("records"))
. When reducing to the provided MRE, the error instead becomes aComputeError
.This is the panic backtrace of the original query, but it's likely the issue happens much earlier from where the panic happens. The records column is created via
.select(records=pl.count())
(in a similar fashion to the one in the MRE):Panic backtrace
Expected behavior
The MRE should provide the following output instead of erroring (it works if
projection_pushdown
is set toFalse
):Installed versions
The text was updated successfully, but these errors were encountered: