connector-x icon indicating copy to clipboard operation
connector-x copied to clipboard

expected struct `polars::prelude::DataFrame`, found struct `polars_core::frame::DataFrame

Open glennpierce opened this issue 2 years ago • 1 comments

Hi asking here as I think it is a technical build issue that wouldn't be answered well on the qa site. Hope that is ok. Thanks.

Hi I have some code from last year using

connectorx from commit 9c0228f8cd44bed612a2d034a7040631883aca9a

arrow2 from commit b9aa8e8da7648559efdc78535085a509a281c55d

and polars

using commit 753dc8c63de705774c71c85b645439169469dc75

the following code works

let mut df: polars::prelude::DataFrame = task::spawn_blocking(move || {
            let mut destination = Arrow2Destination::new();
            let dispatcher = Dispatcher::<_, _, PostgresArrow2Transport<BinaryProtocol, tokio_postgres::NoTls>>::new(
                builder,
                &mut destination,
                &queries,
                Some(select_sql.clone()),
            );
            dispatcher.run().unwrap();
            destination.polars().unwrap()
        })
        .await.unwrap();

        Ok(df)

However, I am now trying to update my dependencies to their latest but I get the following error

error[E0308]: mismatched types
    --> libbmos/src/lib.rs:2069:50
     |
2069 |           let mut df: polars::prelude::DataFrame = task::spawn_blocking(move || {
     |  _____________________--------------------------___^
     | |                     |
     | |                     expected due to this
2070 | |             let mut destination = Arrow2Destination::new();
2071 | |             let dispatcher = Dispatcher::<_, _, PostgresArrow2Transport<BinaryProtocol, tokio_postgres::NoTls>>::new(
2072 | |                 builder,
...    |
2079 | |         })
2080 | |         .await.unwrap();
     | |_______________________^ expected struct `polars::prelude::DataFrame`, found struct `polars_core::frame::DataFrame`
     |
     = note: struct `polars_core::frame::DataFrame` and struct `polars::prelude::DataFrame` have similar names, but are actually distinct types
note: struct `polars_core::frame::DataFrame` is defined in crate `polars_core`
    --> /home/glenn/.cargo/registry/src/github.com-1ecc6299db9ec823/polars-core-0.20.0/src/frame/mod.rs:130:1

I can't seem to find out what has changed to caused this.

I think it may be that connectx depends on polars 0.20 where the latest release is 0.27

Thanks

glennpierce avatar Apr 11 '23 13:04 glennpierce