-
Notifications
You must be signed in to change notification settings - Fork 751
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
fix: add custom (de)serialization methods for special float value #16258
Conversation
Thank you! |
@sundy-li Is supporting infinite for all NumberScalar a good idea? As there is no standard for inf serialization, I'd concern about the forward compatibility because NumberScalar could be persist in meta or settings. On the other aspect, this is an user interface change. We used to / planned to support |
I add a condition |
Yes.
@andylokandy If Now we can also cast string into float64 (but it's not auto-cast)
|
d9bca1c
to
9893150
Compare
Sorry for some time leave. This PR was put on hold because overriding the (de)serialization methods for F32 and F64 still doesn't address the issue. There are parts of the code, such as ValueType::Scalar, that use borsh-serde but are unaffected by this PR's override methods. To work around this problem, I patched borsh-rs to remove the NaN restriction: borsh-rs NaN bypass patch. It's unlikely that the upstream will accept these changes due to potential cross-platform issues with NaN, but we don't encounter this problem in our case. |
You can make it a feature gate that defaults to be disabled. Send a pr to upstream, let the maintainer decide whether to accept it. |
Ok, I will send a PR to upstream later |
I opened a PR yesterday. Maintainers have some concerns about that. near/borsh-rs#308 |
LGTM, maybe we can do better.
then let's implement serde, ord, eq for the new struct And |
I'm concerned about moving the whole lib into databend. As @sundy-li said, we can impl the custom serde logic for Even if we decide to vendor the crate, it's better to give it its own crate rather than moving into |
Thanks for your review.
If we implement these traits (like serde, Ord, Eq, AsRef, From(f32)) ourselves, we’re essentially just duplicating what the ordered-float library already does. In that case, we might vendor the lib directly.
It sounds good to me. I didn't put it into a crate becuase I thought it is a |
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
fixes: #16213
Tests
Type of change
This change is