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

Cannot build with "dtype-categorical" enabled #19063

Closed
2 tasks done
besselfunct opened this issue Oct 2, 2024 · 7 comments · Fixed by #19076
Closed
2 tasks done

Cannot build with "dtype-categorical" enabled #19063

besselfunct opened this issue Oct 2, 2024 · 7 comments · Fixed by #19076
Assignees
Labels
accepted Ready for implementation bug Something isn't working needs triage Awaiting prioritization by a maintainer rust Related to Rust Polars

Comments

@besselfunct
Copy link

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

[dependencies]
polars = {version = "0.43.1", features = ["dtype-categorical"]}

Log output

error[E0599]: no method named `raw_table_mut` found for struct `hashbrown::HashMap` in the current scope
   --> /home/besselfunct/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-core-0.43.1/src/chunked_array/builder/list/categorical.rs:145:33
    |
145 |                 self.idx_lookup.raw_table_mut().find_or_find_insert_slot(
    |                                 ^^^^^^^^^^^^^ method not found in `HashMap<KeyWrapper, (), RandomState>`

error[E0599]: no method named `raw_table_mut` found for struct `hashbrown::HashMap` in the current scope
   --> /home/besselfunct/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-core-0.43.1/src/chunked_array/builder/list/categorical.rs:164:41
    |
164 |                         self.idx_lookup.raw_table_mut().insert_in_slot(
    |                                         ^^^^^^^^^^^^^ method not found in `HashMap<KeyWrapper, (), RandomState>`

error[E0599]: no method named `raw_table_mut` found for struct `hashbrown::HashMap` in the current scope
  --> /home/besselfunct/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-core-0.43.1/src/chunked_array/logical/categorical/builder.rs:43:32
   |
43 |             self.local_mapping.raw_table_mut().find_or_find_insert_slot(
   |                                ^^^^^^^^^^^^^ method not found in `HashMap<KeyWrapper, (), RandomState>`

error[E0599]: no method named `raw_table_mut` found for struct `hashbrown::HashMap` in the current scope
  --> /home/besselfunct/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-core-0.43.1/src/chunked_array/logical/categorical/builder.rs:63:26
   |
62 | /                     self.local_mapping
63 | |                         .raw_table_mut()
   | |                         -^^^^^^^^^^^^^ method not found in `HashMap<KeyWrapper, (), RandomState>`
   | |_________________________|
   |

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

Issue description

Trying to recreate this example from the user guide when I ran into this issue.

Expected behavior

polars-core should build a MWE with the dtype-categorical flag enabled.

Installed versions

dtype-categorical

@besselfunct besselfunct added bug Something isn't working needs triage Awaiting prioritization by a maintainer rust Related to Rust Polars labels Oct 2, 2024
@Shoeboxam
Copy link
Contributor

Shoeboxam commented Oct 2, 2024

Hashbrown just updated to 0.15, with the following section in the changelog:
https://github.com/rust-lang/hashbrown/blob/HEAD/CHANGELOG.md#removed

Polars takes a workspace dependency on hashbrown "0.14", which, by cargo's caret comparison rules, allows the minor version to vary to 0.15 where the API has changed. If Polars took a hashbrown dependency of "0.14.0", then only the patch version would be allowed to vary.

I got things working again by downgrading indexmap in the cargo.lock:

cargo update indexmap@2.6.0 --precise 2.5.0

@besselfunct
Copy link
Author

I apologize, I'm somewhat of a novice when it comes to cargo. I ran the command you suggested, and now I can build, but it looks like my Cargo.toml didn't change. Is there a way to include this information in the Cargo.toml so that it can be explicitly declared?

@Shoeboxam
Copy link
Contributor

I'm not aware of a way to do so via the Cargo.toml.

I'm also observing that my fix above doesn't always work-- cargo somehow still pulls down hashbrown 0.15 when building on other platforms/with cibuildwheel, and I can't seem to control it.

@Bidek56
Copy link
Contributor

Bidek56 commented Oct 2, 2024

I am having the same errors compiling nodejs-polars, does it mean I need to wait for the next release of polars-rs? Thx

@cuviper
Copy link

cuviper commented Oct 3, 2024

Polars is using .raw_table_mut(), so it should explicitly enable hashbrown's "raw" feature.
See also: #19076 (comment)

Yes, indexmap 2.6.0 updated to hashbrown 0.15, but polars will still be using its own hashbrown 0.14.

@c-peters c-peters added the accepted Ready for implementation label Oct 6, 2024
@c-peters c-peters added this to Backlog Oct 6, 2024
@c-peters c-peters moved this to Done in Backlog Oct 6, 2024
@Shoeboxam
Copy link
Contributor

Shoeboxam commented Oct 7, 2024

Thanks, to recap, the temporary Cargo.toml fix, until the Polars crate is updated, is to add the following line to your dependencies:

hashbrown = { version = "=0.14.5", features = ["raw"] }

@cuviper
Copy link

cuviper commented Oct 9, 2024

The precise "=0.14.5" pinning shouldn't be necessary, but that's likely to be the last 0.14 release anyway. The important part is to add the "raw" feature.

sourcefrog added a commit to sourcefrog/duckdb-rs that referenced this issue Dec 21, 2024
Try to get the fix for pola-rs/polars#19063 in a better way to fix CI
Maxxen added a commit to duckdb/duckdb-rs that referenced this issue Feb 7, 2025
* fetch extension name and version from env variable

* set error message

* fix: Support boolean lists

* test: Add boolean list roundtrip test

* Fix link formatting in CONTRIBUTING.md

* derive Debug for Savepoint

* Use ptr::write when writing uninitialized memory

* Use smaller unsafe blocks

* Rust BindData/InitData can just use Rust types

* Use unsafe blocks inside unsafe fns generated by macro

This will prevent the macro generating a warning in edition 2024

* Fix unused import

* Better safety docs for vtab methods

Contrary to the previous docs, the instances passed to these functions are *not* initialized by the caller. Rather, the called function is responsible for writing into uninitialized memory.

* Similar safety fixes in vtab tests

* Update pola-rs

Try to get the fix for pola-rs/polars#19063 in a better way to fix CI

* Remove pola-rs workaround

* Upgrade arrow-rs to 54

* Fix test  to trigger append error

* update to 1.2.0

* update polars again

* reexport polars-arrow, fix lifetime clippy

* upgrade sources, bindgen

* remove polars from default

* uh update source again?

* upgrade bindgen

* limit bindgen

* allow unsatble/deprecated c api for now

* format that shidd

* install openssl

* ok, update it and if it doesnt work we're getting rid of it

* yeet

* remove asan for now

* adjust timestamp tests for utc

* fix logicaltypeid export

* format

* add logicaltypeid export again

---------

Co-authored-by: Sam Ansmink <samansmink@hotmail.com>
Co-authored-by: peasee <98815791+peasee@users.noreply.github.com>
Co-authored-by: Alex Kesling <alex@kesling.co>
Co-authored-by: Zheyu Shen <arsdragonfly@gmail.com>
Co-authored-by: Martin Pool <mbp@sourcefrog.net>
Co-authored-by: John Allen <john@threedogconsulting.com>
Co-authored-by: nm <55702585+bnmoch3@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation bug Something isn't working needs triage Awaiting prioritization by a maintainer rust Related to Rust Polars
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

6 participants