Skip to content

feat: bf16 support#417

Merged
abonander merged 14 commits into
ClickHouse:mainfrom
justventure:feat/bf16-support
Jul 2, 2026
Merged

feat: bf16 support#417
abonander merged 14 commits into
ClickHouse:mainfrom
justventure:feat/bf16-support

Conversation

@justventure

@justventure justventure commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Added support bf16 data type via half #315

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided so that we can include it in CHANGELOG later

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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::BFloat16 with RowBinary-focused serde (de)serialization.
  • Extend RowBinary serializer/deserializer and schema validation to recognize BFloat16 as fixed 2-byte data.
  • Add integration test coverage for inserting/selecting BFloat16 and Nullable(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.

Comment thread src/types/bf16.rs
Comment thread src/types/bf16.rs Outdated
Comment thread Cargo.toml Outdated

@abonander abonander left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Surprisingly this time around, I agree with the Copilot review comments.

Comment thread src/types/bf16.rs
@abonander

Copy link
Copy Markdown
Contributor

@justventure do you have time to address the review comments?

@justventure justventure requested a review from abonander May 18, 2026 01:50

@abonander abonander left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a couple nits, plus rustfmt needs to be run.

Comment thread tests/it/main.rs Outdated
Comment thread src/types/mod.rs
@justventure

Copy link
Copy Markdown
Contributor Author

i was away for approximately one month due to travel, sorry for delay

@justventure justventure requested a review from abonander June 28, 2026 11:39
@abonander abonander merged commit c080930 into ClickHouse:main Jul 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants