Skip to content

test: add tests for partitioned queries to the .NET wrapper#747

Open
olavloite wants to merge 2 commits intomainfrom
spanner-lib-dotnet-test-partitioned-query
Open

test: add tests for partitioned queries to the .NET wrapper#747
olavloite wants to merge 2 commits intomainfrom
spanner-lib-dotnet-test-partitioned-query

Conversation

@olavloite
Copy link
Collaborator

Adds a test to verify that partitioned queries work in the .NET wrapper.

@olavloite olavloite requested a review from a team as a code owner February 4, 2026 13:27
@olavloite olavloite requested a review from bhatt4982 February 4, 2026 13:27
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @olavloite, 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 introduces the necessary infrastructure and testing to support partitioned queries within the .NET wrapper for SpannerLib. It extends the mock server to simulate the partitioning process and adapts its query execution to handle partition-specific tokens. A new, robust test case has been added to ensure that the .NET wrapper correctly processes and aggregates results from these partitioned queries, verifying the feature's functionality.

Highlights

  • Mock Spanner Server Update: The MockSpannerServer now includes an implementation for the PartitionQuery method, which simulates the creation of query partitions. This method generates a specified or random number of partitions, each with a unique token, and integrates with existing session and transaction management.
  • Partitioned Query Execution Logic: The PrepareExecuteSql method within the mock server has been enhanced to correctly identify and retrieve statement results for individual query partitions. It now prioritizes using the PartitionToken from the request for result lookup, falling back to the SQL query string if no token is present.
  • New Test for Partitioned Queries: A comprehensive test method, TestPartitionedQuery, has been added to RowsTests.cs. This test validates the end-to-end functionality of partitioned queries in the .NET wrapper by setting up mock data, distributing rows across simulated partitions, executing a partitioned query, and asserting that the total number of rows returned matches the expected count.
Changelog
  • spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-mockserver/MockSpannerServer.cs
    • Added PartitionQuery method to simulate query partitioning and token generation.
    • Modified PrepareExecuteSql to use PartitionToken for statement result lookup, enabling support for partitioned query execution.
  • spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-tests/RowsTests.cs
    • Added TestPartitionedQuery to verify the functionality of partitioned queries in the .NET wrapper, including mock data setup and result aggregation.
Activity
  • No activity has been recorded for this pull request yet.
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
Contributor

@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 adds support and tests for partitioned queries to the .NET wrapper. The changes include implementing PartitionQuery in the mock server and adding a corresponding integration test. The implementation looks solid and the test effectively covers the new functionality. I have one suggestion to improve the test data generation to be more random and less biased.

@olavloite olavloite force-pushed the spanner-lib-dotnet-test-partitioned-query branch from 705c276 to e6790fb Compare February 4, 2026 13:50
Copy link
Contributor

@bhatt4982 bhatt4982 left a comment

Choose a reason for hiding this comment

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

LGTM...

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