Skip to content

test(spanner): add tests for creating tables w/o primary keys - #4073

Open
hengfengli wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
hengfengli:tables-no-pks
Open

test(spanner): add tests for creating tables w/o primary keys#4073
hengfengli wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
hengfengli:tables-no-pks

Conversation

@hengfengli

Copy link
Copy Markdown
Contributor

No description provided.

@hengfengli
hengfengli requested a review from a team as a code owner July 29, 2026 05:53
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 test cases to verify the handling of Spanner tables that do not have primary keys. The changes ensure that the conversion logic between Avro schemas and DDL statements remains robust when dealing with hidden identity columns in such tables. Additionally, the integration test suite has been expanded to cover these scenarios, confirming that data export pipelines function correctly for these table configurations.

Highlights

  • Testing: Added comprehensive test coverage for creating Spanner tables without primary keys, including Avro schema conversion and DDL validation.
  • Integration Testing: Updated ExportPipelineIT to include scenarios for tables lacking primary keys, ensuring correct data export and validation.
  • Schema Handling: Validated that AvroSchemaToDdlConverter and DdlToAvroSchemaConverter correctly handle hidden identity columns in tables without explicit primary keys.
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 the 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 counterproductive. 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.

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.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces test coverage and schema definitions for Spanner tables without an explicit primary key, which utilize a hidden rowid column as their primary key. It adds unit tests for Avro-to-DDL and DDL-to-Avro conversions, updates database copy tests for both GoogleSQL and PostgreSQL dialects, and integrates these tables into the export pipeline integration tests. There are no review comments, and I have no feedback to provide.

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.06%. Comparing base (0ba3459) to head (850a42f).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4073      +/-   ##
============================================
+ Coverage     55.82%   56.06%   +0.23%     
- Complexity     6851     6868      +17     
============================================
  Files          1127     1127              
  Lines         68768    68572     -196     
  Branches       7768     7757      -11     
============================================
+ Hits          38390    38445      +55     
+ Misses        27887    27645     -242     
+ Partials       2491     2482       -9     
Components Coverage Δ
spanner-templates 87.42% <ø> (-0.14%) ⬇️
spanner-import-export 68.91% <ø> (+0.04%) ⬆️
spanner-live-forward-migration 89.26% <ø> (-0.02%) ⬇️
spanner-live-reverse-replication 83.18% <ø> (-0.27%) ⬇️
spanner-bulk-migration 92.23% <ø> (-0.01%) ⬇️
gcs-spanner-dv 88.54% <ø> (-0.02%) ⬇️
see 46 files with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bharadwaj-aditya
bharadwaj-aditya requested review from bharadwaj-aditya and darshan-sj and removed request for aasthabharill and sm745052 July 31, 2026 04:32
@bharadwaj-aditya bharadwaj-aditya added the addition New feature or request label Jul 31, 2026

@bharadwaj-aditya bharadwaj-aditya 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.

These changes look fine. But we also need to add a test in copydb test.

@hengfengli

Copy link
Copy Markdown
Contributor Author

These changes look fine. But we also need to add a test in copydb test.

Good suggestion. Just added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

addition New feature or request size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants