Skip to content

Conversation

@liuzicheng1987
Copy link
Contributor

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @liuzicheng1987, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where C++ int and float types were not being serialized to their corresponding Avro primitive types, instead being promoted to long and double respectively. The changes ensure accurate type mapping for these primitives, improve error reporting, and enhance the overall testing framework by introducing cross-format validation with JSON. The refactoring also includes the adoption of C++ concepts for more flexible type handling and a correction in the Avro schema definition for double types.

Highlights

  • Correct Avro Type Mapping for Integers and Floats: The Avro writer has been updated to correctly map C++ int to Avro int and C++ float to Avro float. Previously, int values were implicitly written as long and float values as double, which could lead to schema mismatches or unnecessary data size.
  • Enhanced Type Handling with C++ Concepts: The Reader.hpp now utilizes C++ concepts (concepts::MutableContiguousByteContainer) for more generic and robust type checking of byte containers, replacing specific std::is_same checks for rfl::Bytestring and rfl::Vectorstring.
  • Improved Error Handling and Readability: Error messages across Reader.hpp and Writer.cpp have been refined for clarity and consistency, often including function names and error codes. Additionally, noexcept specifiers have been removed from several methods in Parser.hpp and Writer.hpp/Writer.cpp, indicating that these operations may now throw exceptions upon failure.
  • Schema Correction for Double Type: The Avro schema definition for Double types in Type.hpp has been corrected to explicitly use "double" instead of "float".
  • Robust Test Coverage with JSON Comparison: A new testing utility, write_and_read_with_json, has been introduced and adopted across all Avro tests. This utility not only verifies Avro serialization/deserialization but also compares the resulting data's JSON representation, significantly enhancing test robustness and data integrity checks.
  • New Test Case for Primitive Types: A dedicated test file (test_float_and_int.cpp) has been added to specifically validate the correct serialization and deserialization of float, double, int, and long types in Avro.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a great improvement. It correctly addresses the issue of writing Avro integers and floats by using more specific types, which fixes issue #522. The refactoring to use concepts for byte containers is a nice modernization, and the code formatting changes improve readability. The testing is also significantly improved by adding a new test case for numeric types and enhancing existing tests to perform a more robust validation using JSON comparison. I have one suggestion regarding the integer serialization logic to make it more portable and robust against overflows.

@liuzicheng1987 liuzicheng1987 merged commit 3ae6833 into main Oct 25, 2025
292 checks passed
@liuzicheng1987 liuzicheng1987 deleted the f/avro_float branch October 28, 2025 23:08
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.

2 participants