pola-rs / polars

Dataframes powered by a multithreaded, vectorized query engine, written in Rust
https://docs.pola.rs
Other
30.26k stars 1.96k forks source link

Compile error for 0.30 #9118

Closed sun-rs closed 1 year ago

sun-rs commented 1 year ago

Polars version checks

Issue description

图片

When compile newly realeased 0.30, it shows no method named extend_from_slice_unchecked found

Reproducible example

none

Expected behavior

none

Installed versions

none
ritchie46 commented 1 year ago

Have you got a minimal repro?

sun-rs commented 1 year ago

polars 0.29 and pyo3-polars 0.3.0 works well, but after change 0.29 to 0.30 and use pyo3-polars 0.4.0, I got that compile error.

os: win11 rust: rustc 1.69.0 (84c898d65 2023-04-16) toolchain: stable-x86_64-pc-windows-msvc

cargo.toml as below

[workspace.dependencies]
pyo3 = { version = "0.18.3", features = ["hashbrown", "extension-module", "chrono", "anyhow"] } #"multiple-pymethods"
pyo3-polars = "0.4.0"
pyo3-log = "0.8.1"
log = "0.4.17"
hashbrown = { version = "0.13.2", features = ["rayon"] }
rayon = "1.7.0"
chrono = "0.4.24"
chrono-tz = { version = "0.8.2"}
lazy_static = "1.4.0"
regex = "1.8.1"
anyhow = "1.0.71"
thiserror = "1.0.40"
serde = { version = "1.0.163", features = ["derive"] }
serde_json = "1.0.96"
polars-io = { version = "0.30.0", features = ["private"], default-features = false }
polars-core = { version = "0.30.0", default-features = false }
polars-arrow = { version = "0.30.0", features = ["compute"] }
itertools = "0.10.5"

[workspace.dependencies.polars]
version = "0.30.0"
features = [
  "dynamic_groupby",
  "zip_with",
  "lazy",
  "strings",
  "temporal",
  "random",
  "fmt",
  "dtype-full",
  "rows",
  "private",
  "round_series",
  "is_first",
  "is_unique",
  "dot_product",
  "concat_str",
  "row_hash",
  "reinterpret",
  "mode",
  "cum_agg",
  "rolling_window",
  "interpolate",
  "rank",
  "diff",
  "moment",
  "arange",
  "true_div",
  "dtype-categorical",
  "diagonal_concat",
  "horizontal_concat",
  "abs",
  "ewma",
  "dot_diagram",
  "dataframe_arithmetic",
  "string_encoding",
  "product",
  "ndarray",
  "unique_counts",
  "log",
  "serde-lazy",
  "partition_by",
  "semi_anti_join",
  "list_eval",
  "cumulative_eval",
  "list_to_struct",
  "to_dummies",
  "string_justify",
  "string_from_radix",
  "arg_where",
  "date_offset",
  "date_offset",
  "approx_unique",
  "parquet"
]
ritchie46 commented 1 year ago

I opened a new project and I can compile. Did you remove your lockfile and target directory?

chitralverma commented 1 year ago

Same here, no compilation issues with the latest branch, cant reproduce.

@longilacus try running https://crates.io/crates/cargo-clean-all in the root of your repo and then try rebuilding.

Michael-J-Ward commented 1 year ago

Polars 0.30 requires arrow2 at 0.17.2, but only declares 0.17 as the minimum version. So, updating polars from 0.29 to 0.30 doesn't update the arrow2 dependency.

Start with this Cargo.toml, and run cargo check

The arrow2 dependency is explicitly pinned for generating the initial lockfile because that it is what users will have.

[package]
name = "polars-compile-bug"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
arrow2 = "=0.17.1"
polars = { version = "0.29", features = ["lazy", "strings", "timezones"] }

After Cargo.lock is written with arrow2 = 0.17.1, you can update the dependencies

[dependencies]
polars = { version = "0.30", features = ["lazy", "strings", "timezones"] }
error[E0599]: no method named `is_sliced` found for reference `&arrow2::buffer::Buffer<<S as datatypes::PolarsNumericType>::Native>` in the current scope
  --> /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/polars-core-0.30.0/src/chunked_array/ops/apply.rs:82:35
   |
82 |             if owned_arr.values().is_sliced() {
   |                                   ^^^^^^^^^ help: there is a method with a similar name: `slice`

error[E0599]: no method named `is_sliced` found for reference `&arrow2::buffer::Buffer<<T as datatypes::PolarsNumericType>::Native>` in the current scope
  --> /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/polars-core-0.30.0/src/chunked_array/ops/extend.rs:65:25
   |
65 |         if arr.values().is_sliced() {
   |                         ^^^^^^^^^ help: there is a method with a similar name: `slice`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `polars-core` due to 2 previous errors

As you can see, Polars 0.30 depends on the arrow2::buffer::Buffer::is_sliced, introduced in this commit;

ritchie46 commented 1 year ago

On people being hit by this.

Remove Cargo.lock and compile again.

sun-rs commented 1 year ago

Remove Cargo.lock works. Thank you!