Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

profile on simple filter return Err("no data to time") #19983

Open
2 tasks done
rluvaton opened this issue Nov 25, 2024 · 0 comments
Open
2 tasks done

profile on simple filter return Err("no data to time") #19983

rluvaton opened this issue Nov 25, 2024 · 0 comments
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer rust Related to Rust Polars

Comments

@rluvaton
Copy link

rluvaton commented Nov 25, 2024

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

#[cfg(test)]
mod tests {
    use polars::prelude::{Series, col, Column, DataFrame, IntoLazy, NamedFrom};
    use std::env;

    #[test]
    fn should_work_with_polars() {

        env::set_var("POLARS_VERBOSE", "1");
        env::set_var("POLARS_BACKTRACE_IN_ERR", "1"); // <-- added just for debugging

        let my_col = Series::new("my_col".into(), [None, Some(1)].as_ref());
        let df = DataFrame::new(vec![Column::from(my_col)]).unwrap();
        let polars_plan = df
            //
            .lazy()
            .filter(col("my_col").is_not_null());

        let result = polars_plan.profile();

        match result {
            Ok(dataframe) => {
                println!("Everything is fine");
            }
            Err(err) => {
                eprintln!("Error: {}", err);
                panic!("Failed to execute plan");
            }
        }
    }
}

Log output

Error: no data to time

Rust backtrace:
   0: std::backtrace_rs::backtrace::libunwind::trace
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1: std::backtrace_rs::backtrace::trace_unsynchronized
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2: std::backtrace::Backtrace::create
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/backtrace.rs:331:13
   3: <polars_error::ErrString as core::convert::From<T>>::from
             at /home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-error-0.44.2/src/lib.rs:49:17
   4: <T as core::convert::Into<U>>::into
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/convert/mod.rs:759:9
   5: polars_expr::state::node_timer::NodeTimer::finish
             at /home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-expr-0.44.2/src/state/node_timer.rs:42:9
   6: polars_expr::state::execution_state::ExecutionState::finish_timer
             at /home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-expr-0.44.2/src/state/execution_state.rs:105:9
   7: polars_lazy::frame::LazyFrame::profile
             at /home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-lazy-0.44.2/src/frame/mod.rs:748:24
   8: polars_pg::tests::should_work_with_polars
             at ./src/lib.rs:18:22
   9: polars_pg::tests::should_work_with_polars::{{closure}}
             at ./src/lib.rs:7:33
  10: core::ops::function::FnOnce::call_once
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/ops/function.rs:250:5
  11: core::ops::function::FnOnce::call_once
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/ops/function.rs:250:5
  12: test::__rust_begin_short_backtrace
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/test/src/lib.rs:620:18
  13: test::run_test_in_process::{{closure}}
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/test/src/lib.rs:643:60
  14: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panic/unwind_safe.rs:272:9
  15: std::panicking::try::do_call
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:554:40
  16: std::panicking::try
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:518:19
  17: std::panic::catch_unwind
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panic.rs:345:14
  18: test::run_test_in_process
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/test/src/lib.rs:643:27
  19: test::run_test::{{closure}}
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/test/src/lib.rs:564:43
  20: test::run_test::{{closure}}
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/test/src/lib.rs:594:41
  21: std::sys::backtrace::__rust_begin_short_backtrace
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/sys/backtrace.rs:154:18
  22: std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/thread/mod.rs:522:17
  23: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panic/unwind_safe.rs:272:9
  24: std::panicking::try::do_call
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:554:40
  25: std::panicking::try
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:518:19
  26: std::panic::catch_unwind
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panic.rs:345:14
  27: std::thread::Builder::spawn_unchecked_::{{closure}}
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/thread/mod.rs:521:30
  28: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/ops/function.rs:250:5
  29: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/alloc/src/boxed.rs:2231:9
  30: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/alloc/src/boxed.rs:2231:9
  31: std::sys::pal::unix::thread::Thread::new::thread_start
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/sys/pal/unix/thread.rs:105:17
  32: __pthread_deallocate


Failed to execute plan
thread 'tests::should_work_with_polars' panicked at polars_pg/src/lib.rs:26:17:
Failed to execute plan
stack backtrace:
   0: rust_begin_unwind
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:662:5
   1: core::panicking::panic_fmt
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panicking.rs:74:14
   2: polars_pg::tests::should_work_with_polars
             at ./src/lib.rs:26:17
   3: polars_pg::tests::should_work_with_polars::{{closure}}
             at ./src/lib.rs:7:33
   4: core::ops::function::FnOnce::call_once
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/ops/function.rs:250:5
   5: core::ops::function::FnOnce::call_once
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Issue description

I'm trying to do simple profile but I get Error: no data to time.

when I change profile call to collect it works fine obviously

Expected behavior

The code above should not fail.

and also if for some reason the timer do fail it should not affect the actual data result
So instead of:

pub fn profile(self) -> PolarsResult<(DataFrame, DataFrame)>

It should be:

pub fn profile(self) -> (PolarsResult<DataFrame>, PolarsResult<DataFrame>) 

I'm willing to open a PR for that but I know it's a breaking change...

Installed versions

This is my cargo.toml file

[package]
name = "polars_pg"
version = "0.1.0"
edition = "2021"

[dependencies]
polars = { version = "0.44.2",features = ["lazy" ] }
@rluvaton rluvaton added bug Something isn't working needs triage Awaiting prioritization by a maintainer rust Related to Rust Polars labels Nov 25, 2024
@rluvaton rluvaton changed the title profile on simple filter panic profile on simple filterreturn no data to time Nov 25, 2024
@rluvaton rluvaton changed the title profile on simple filterreturn no data to time profile on simple filter return no data to time Nov 25, 2024
@rluvaton rluvaton changed the title profile on simple filter return no data to time profile on simple filter return Err("no data to time") Nov 25, 2024
@rluvaton rluvaton changed the title profile on simple filter return Err("no data to time") profile on simple filter return Err("no data to time") Nov 25, 2024
rluvaton-flarion pushed a commit to flarioncode/polars that referenced this issue Nov 25, 2024
rluvaton-flarion added a commit to flarioncode/polars that referenced this issue Nov 25, 2024
…llect result as well (#23)

* Fix `profile` on simple filter return `Err("no data to time")`

Ref: pola-rs#19983

* change to be a new function

---------

Co-authored-by: Raz Luvaton <16746759+rluvaton@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer rust Related to Rust Polars
Projects
None yet
Development

No branches or pull requests

1 participant