Skip to content

refactor(bigtable): reorganize query public types and files#15744

Merged
scotthart merged 3 commits intogoogleapis:mainfrom
scotthart:bigtable_results_cleanup
Nov 12, 2025
Merged

refactor(bigtable): reorganize query public types and files#15744
scotthart merged 3 commits intogoogleapis:mainfrom
scotthart:bigtable_results_cleanup

Conversation

@scotthart
Copy link
Member

renames results.h to result_source_interface.h
collects all the RowStream, TupleStream, and associated iterators into a single header file row_stream.h
moves tests around appropriately

@scotthart scotthart requested a review from a team November 11, 2025 00:35
@product-auto-label product-auto-label bot added the api: bigtable Issues related to the Bigtable API. label Nov 11, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @scotthart, 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 undertakes a significant refactoring effort to improve the organization and clarity of query-related types within the Bigtable and Spanner client libraries. By renaming a generic "results" header to a more specific "result source interface" and consolidating all stream-related classes and iterators into new "row stream" files, the changes aim to create a more intuitive and maintainable codebase. This reorganization helps delineate responsibilities and makes it easier to locate and understand the components involved in processing query results.

Highlights

  • Renamed results.h to result_source_interface.h: This change provides a more descriptive name for the interface defining how query results are sourced, improving clarity on its purpose.
  • Consolidated Stream Types into row_stream.h and row_stream.cc: Classes like RowStream, TupleStream, and their associated iterators (RowStreamIterator, TupleStreamIterator) have been moved from query_row.h and the old results.h into new, dedicated row_stream files. This centralizes stream-related functionalities.
  • Updated Build Configurations and Dependencies: CMakeLists.txt and google_cloud_cpp_bigtable.bzl were updated to reflect the new file structure, and various source/header files now include the correct new headers, ensuring the project builds correctly with the refactored files.
  • Refactored Test Files: Existing tests for the moved stream functionalities were relocated to a new row_stream_test.cc file, and query_row_test.cc was cleaned up by removing the moved test cases.
  • Spanner Module Alignment: The google/cloud/spanner module also saw a corresponding rename of results.cc to result_source_interface.cc for consistency across the codebase.
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 refactors the Bigtable client library by reorganizing query-related public types. results.h is renamed to result_source_interface.h, and various stream and iterator classes are consolidated into new row_stream.h and row_stream.cc files. The changes are well-structured and improve the organization of the code.

My review includes a few points:

  • A critical fix for missing header includes in the new row_stream.h file, which would cause compilation errors.
  • A suggestion to remove unused headers in row_stream.cc.
  • A high-severity finding regarding a likely accidental and inconsistent file rename in the spanner component, which is out of scope for this PR.

Overall, this is a good refactoring. Addressing these points will ensure the correctness and consistency of the codebase.

#include "google/cloud/bigtable/result_source_interface.h"
#include "google/cloud/bigtable/version.h"
#include "google/cloud/status_or.h"
#include <memory>

Choose a reason for hiding this comment

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

critical

This header is missing some includes that were present in query_row.h and are still needed for the moved code to compile:

  • google/cloud/internal/make_status.h: for GetSingularRow.
  • <utility>: for std::move used in GetSingularRow and TupleStreamIterator.
  • <functional>: for std::function used in RowStreamIterator::Source.
  • <iterator>: for std::input_iterator_tag used in RowStreamIterator and TupleStreamIterator.
#include <memory>
#include "google/cloud/internal/make_status.h"
#include <functional>
#include <iterator>
#include <utility>

Comment on lines +16 to +20
#include "google/cloud/internal/make_status.h"
#include "google/cloud/log.h"
#include "google/cloud/status.h"
#include "google/cloud/status_or.h"
#include <algorithm>

Choose a reason for hiding this comment

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

medium

These headers are not used in this file and can be removed to reduce dependencies and improve compilation times.

@codecov
Copy link

codecov bot commented Nov 11, 2025

Codecov Report

❌ Patch coverage is 99.27361% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.04%. Comparing base (601c5b8) to head (f76ad26).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
google/cloud/bigtable/row_stream.h 96.22% 2 Missing ⚠️
google/cloud/bigtable/row_stream.cc 95.83% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15744   +/-   ##
=======================================
  Coverage   93.03%   93.04%           
=======================================
  Files        2445     2448    +3     
  Lines      226036   226036           
=======================================
+ Hits       210301   210307    +6     
+ Misses      15735    15729    -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

diegomarquezp
diegomarquezp previously approved these changes Nov 11, 2025
mpeddada1
mpeddada1 previously approved these changes Nov 11, 2025
@scotthart scotthart enabled auto-merge (squash) November 12, 2025 20:20
@scotthart scotthart merged commit 465ce17 into googleapis:main Nov 12, 2025
68 of 70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the Bigtable API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants