Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2869,7 +2869,11 @@ fn intersect_maps<'a>(
let mut inputs = inputs.into_iter();
let mut merged: HashMap<String, String> = inputs.next().cloned().unwrap_or_default();
for input in inputs {
merged.retain(|k, v| input.get(k) == Some(v));
// The extra dereference below (`&*v`) is a workaround for https://github.com/rkyv/rkyv/issues/434.
// When this crate is used in a workspace that enables the `rkyv-64` feature in the `chrono` crate,
// this triggers a Rust compilation error:
// error[E0277]: can't compare `Option<&std::string::String>` with `Option<&mut std::string::String>`.
Comment on lines +2874 to +2875
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to reproduce the error, but didn't:

fn main() {
    let mut s =  String::from("hello");
    let ss = String::from("hello");
    let option_ref: Option<&String> = Some(&ss);
    let mut_ref = &mut s;

    if option_ref == Some(mut_ref) //Option<&mut String> {
    {
        println!("They are equal!");
    }
}

Maybe I didn't notice anything?

Copy link
Contributor

@comphead comphead Feb 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it compiler dependent? I was not able to reproduce either on latest compiler

UPD: i was able to reproduce it when enable feature in Cargo.toml

chrono = { version = "0.4.38", default-features = false, features = ["rkyv-64"] }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xudong963 , please modify your example like this to reproduce:

  • Add chrono as a dependency to Cargo.toml:
[dependencies]

chrono = { version = "0.4.38", default-features = false, features = ["rkyv-64"] }
  • Add chrono import to main.rs:
use chrono::*;

merged.retain(|k, v| input.get(k) == Some(&*v));
}
merged
}
Expand Down