feat: bf16 support#417
Conversation
There was a problem hiding this comment.
Pull request overview
Adds ClickHouse BFloat16 (brain floating point 16-bit) support to the crate’s bespoke types module and teaches the RowBinary (de)serializer + schema validator to treat it as a fixed-size 2-byte value, with integration/unit tests to validate round-trips and Nullable behavior.
Changes:
- Introduce
types::BFloat16with RowBinary-focused serde (de)serialization. - Extend RowBinary serializer/deserializer and schema validation to recognize
BFloat16as fixed 2-byte data. - Add integration test coverage for inserting/selecting
BFloat16andNullable(BFloat16).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/it/main.rs | Registers the new bfloat16 integration test module. |
| tests/it/bfloat16.rs | End-to-end integration test for BFloat16 and Nullable(BFloat16) behavior. |
| src/types/mod.rs | Re-exports BFloat16 and wires the new bf16 module into types. |
| src/types/bf16.rs | Implements the BFloat16 type, conversions, constants, and serde encoding for RowBinary. |
| src/rowbinary/validation.rs | Allows SerdeType::Bytes(2) to match ClickHouse BFloat16 during schema validation. |
| src/rowbinary/ser.rs | Treats BFloat16 as fixed-size bytes (no length prefix) during RowBinary serialization. |
| src/rowbinary/de.rs | Treats BFloat16 as fixed-size bytes during RowBinary deserialization. |
| Cargo.toml | Adds the half crate dependency used for conversions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
abonander
left a comment
There was a problem hiding this comment.
Surprisingly this time around, I agree with the Copilot review comments.
|
@justventure do you have time to address the review comments? |
abonander
left a comment
There was a problem hiding this comment.
Just a couple nits, plus rustfmt needs to be run.
|
i was away for approximately one month due to travel, sorry for delay |
Summary
Added support bf16 data type via half #315
Checklist
Delete items not relevant to your PR: