forust icon indicating copy to clipboard operation
forust copied to clipboard

multiple `is_null_unchecked` found

Open samutigro opened this issue 9 months ago • 1 comments

I tried the pure rust code example and I get these error running the code this is the code `use forust_ml::{GradientBooster, Matrix}; use polars::prelude::*; use reqwest::blocking::Client; use std::error::Error; use std::io::Cursor;

fn main() -> Result<(), Box<dyn Error>> { let data: Vec = Client::new() .get("https://raw.githubusercontent.com/mwaskom/seaborn-data/master/titanic.csv") .send()? .text()? .bytes() .collect();

let df = CsvReader::new(Cursor::new(data))
    .has_header(true)
    .finish()?
    .select(["survived", "pclass", "age", "sibsp", "parch", "fare"])?;

// Get data in column major format...
let id_vars: Vec<&str> = Vec::new();
let mdf = df.melt(id_vars, ["pclass", "age", "sibsp", "parch", "fare"])?;

let data: Vec<f64> = mdf
    .select_at_idx(1)
    .expect("Invalid column")
    .f64()?
    .into_iter()
    .map(|v| v.unwrap_or(f64::NAN))
    .collect();
let y: Vec<f64> = df
    .column("survived")?
    .cast(&DataType::Float64)?
    .f64()?
    .into_iter()
    .map(|v| v.unwrap_or(f64::NAN))
    .collect();

// Create Matrix from ndarray.
let matrix = Matrix::new(&data, y.len(), 5);

// Create booster.
// To provide parameters generate a default booster, and then use
// the relevant `set_` methods for any parameters you would like to
// adjust.
let mut model = GradientBooster::default().set_learning_rate(0.3);
model.fit_unweighted(&matrix, &y, None)?;

// Predict output.
println!("{:?} ...", &model.predict(&matrix, true)[0..10]);
Ok(())

}`

this the error:

``forust_testgit:(main) ✗ cargo run Compiling polars-arrow v0.28.0 error[E0034]: multiple applicable items in scope --> /Users/samueleauteri/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-arrow-0.28.0/src/array/get.rs:31:17 | 31 | if self.is_null_unchecked(item) { | ^^^^^^^^^^^^^^^^^ multipleis_null_uncheckedfound | note: candidate #1 is defined in an impl of the traitIsValidfor the typeA--> /Users/samueleauteri/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-arrow-0.28.0/src/is_valid.rs:31:5 | 31 | unsafe fn is_null_unchecked(&self, i: usize) -> bool { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: candidate #2 is defined in an impl of the traitarrow2::array::Arrayfor the typearrow2::array::PrimitiveArray<T>` help: disambiguate the method for candidate #1 | 31 | if IsValid::is_null_unchecked(&self, item) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: disambiguate the method for candidate #2 | 31 | if arrow2::array::Array::is_null_unchecked(&self, item) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope --> /Users/samueleauteri/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-arrow-0.28.0/src/array/get.rs:54:17 | 54 | if self.is_null_unchecked(item) { | ^^^^^^^^^^^^^^^^^ multiple is_null_unchecked found | note: candidate #1 is defined in an impl of the trait IsValid for the type A --> /Users/samueleauteri/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-arrow-0.28.0/src/is_valid.rs:31:5 | 31 | unsafe fn is_null_unchecked(&self, i: usize) -> bool { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: candidate #2 is defined in an impl of the trait arrow2::array::Array for the type arrow2::array::BooleanArray help: disambiguate the method for candidate #1 | 54 | if IsValid::is_null_unchecked(&self, item) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: disambiguate the method for candidate #2 | 54 | if arrow2::array::Array::is_null_unchecked(&self, item) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope --> /Users/samueleauteri/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-arrow-0.28.0/src/array/get.rs:77:17 | 77 | if self.is_null_unchecked(item) { | ^^^^^^^^^^^^^^^^^ multiple is_null_unchecked found | note: candidate #1 is defined in an impl of the trait IsValid for the type A --> /Users/samueleauteri/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-arrow-0.28.0/src/is_valid.rs:31:5 | 31 | unsafe fn is_null_unchecked(&self, i: usize) -> bool { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: candidate #2 is defined in an impl of the trait arrow2::array::Array for the type arrow2::array::Utf8Array<O> help: disambiguate the method for candidate #1 | 77 | if IsValid::is_null_unchecked(&self, item) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: disambiguate the method for candidate #2 | 77 | if arrow2::array::Array::is_null_unchecked(&self, item) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope --> /Users/samueleauteri/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-arrow-0.28.0/src/array/get.rs:100:17 | 100 | if self.is_null_unchecked(item) { | ^^^^^^^^^^^^^^^^^ multiple is_null_unchecked found | note: candidate #1 is defined in an impl of the trait IsValid for the type A --> /Users/samueleauteri/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-arrow-0.28.0/src/is_valid.rs:31:5 | 31 | unsafe fn is_null_unchecked(&self, i: usize) -> bool { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: candidate #2 is defined in an impl of the trait arrow2::array::Array for the type arrow2::array::BinaryArray<O> help: disambiguate the method for candidate #1 | 100 | if IsValid::is_null_unchecked(&self, item) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: disambiguate the method for candidate #2 | 100 | if arrow2::array::Array::is_null_unchecked(&self, item) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope --> /Users/samueleauteri/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-arrow-0.28.0/src/array/get.rs:124:17 | 124 | if self.is_null_unchecked(item) { | ^^^^^^^^^^^^^^^^^ multiple is_null_unchecked found | note: candidate #1 is defined in an impl of the trait IsValid for the type A --> /Users/samueleauteri/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-arrow-0.28.0/src/is_valid.rs:31:5 | 31 | unsafe fn is_null_unchecked(&self, i: usize) -> bool { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: candidate #2 is defined in an impl of the trait arrow2::array::Array for the type arrow2::array::ListArray<O> help: disambiguate the method for candidate #1 | 124 | if IsValid::is_null_unchecked(&self, item) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ help: disambiguate the method for candidate #2 | 124 | if arrow2::array::Array::is_null_unchecked(&self, item) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For more information about this error, try rustc --explain E0034. error: could not compile polars-arrow (lib) due to 5 previous errors```

samutigro avatar May 02 '24 13:05 samutigro