Skip to content

Add Foreign Key ON DELETE SET NULL support for Cloud Spanner Avro tem… - #4152

Open
sachinagarwal1111 wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
sachinagarwal1111:spanner-fk-on-delete-set-null
Open

Add Foreign Key ON DELETE SET NULL support for Cloud Spanner Avro tem…#4152
sachinagarwal1111 wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
sachinagarwal1111:spanner-fk-on-delete-set-null

Conversation

@sachinagarwal1111

Copy link
Copy Markdown

…plate

@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 support for the 'ON DELETE SET NULL' referential action within the Cloud Spanner DDL management components. The changes ensure that this action is correctly parsed, represented, and serialized during DDL and Avro schema conversions, while also updating random DDL generation for testing purposes.

Highlights

  • Support for ON DELETE SET NULL: Added support for the 'ON DELETE SET NULL' referential action in Cloud Spanner DDL parsing and generation.
  • Codebase Updates: Updated the ReferentialAction enum, DDL pretty-printing logic, and DDL-to-Avro conversion logic to handle the new action.
  • Test Coverage: Expanded test suites, including AvroSchemaToDdlConverterTest, DdlToAvroSchemaConverterTest, and RandomDdlGenerator, to validate the new functionality.
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 adds support for the ON_DELETE_SET_NULL referential action for foreign keys in Cloud Spanner DDL, moving it from the unsupported to the supported actions list and updating parsing, pretty printing, and test cases. However, the reviewer identified two critical issues in AvroSchemaToDdlConverterTest.java where tests will fail due to incomplete updates: in simple(), the expected output was updated without updating the input Avro schema, and in pgSimple(), the input was updated without updating the corresponding assertion.

@sachinagarwal1111
sachinagarwal1111 force-pushed the spanner-fk-on-delete-set-null branch from 1843779 to e455c29 Compare August 18, 2026 14:42
@sachinagarwal1111

Copy link
Copy Markdown
Author

Fixed test failure.

@pratickchokhani

Copy link
Copy Markdown
Contributor

I didn't see any Integration tests? I believe it's because the feature is not launched in Spanner.

How about create a tracking bug and linking it as TODO?

@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.16%. Comparing base (d92bde9) to head (56e9aec).
⚠️ Report is 30 commits behind head on main.

Additional details and impacted files
@@              Coverage Diff              @@
##               main    #4152       +/-   ##
=============================================
+ Coverage     35.83%   56.16%   +20.33%     
- Complexity      711     6974     +6263     
=============================================
  Files           250     1129      +879     
  Lines         17131    69322    +52191     
  Branches       1750     7850     +6100     
=============================================
+ Hits           6139    38937    +32798     
- Misses        10479    27891    +17412     
- Partials        513     2494     +1981     
Components Coverage Δ
spanner-templates 86.38% <ø> (∅)
spanner-import-export 69.04% <100.00%> (∅)
spanner-live-forward-migration 89.55% <ø> (∅)
spanner-live-reverse-replication 84.77% <ø> (∅)
spanner-bulk-migration 89.54% <ø> (∅)
gcs-spanner-dv 88.88% <ø> (∅)
Files with missing lines Coverage Δ
.../google/cloud/teleport/spanner/ddl/ForeignKey.java 90.90% <100.00%> (ø)

... and 903 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.

@sachinagarwal1111

Copy link
Copy Markdown
Author

I didn't see any Integration tests? I believe it's because the feature is not launched in Spanner.

How about create a tracking bug and linking it as TODO?

Yes, that's correct. Since the feature is not launched yet, I didn't add integration test. Added a TODO with tracking bug id.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants