Skip to content

[googlecloud-to-googlecloud] Add Spanner Capture Type: NEW_ROW_AND_OLD_VALUES for AVRO files #3846

Open
ahlie88 wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
ahlie88:spanner_capture_type_fix
Open

[googlecloud-to-googlecloud] Add Spanner Capture Type: NEW_ROW_AND_OLD_VALUES for AVRO files #3846
ahlie88 wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
ahlie88:spanner_capture_type_fix

Conversation

@ahlie88

@ahlie88 ahlie88 commented May 22, 2026

Copy link
Copy Markdown

The capture type NEW_ROW_AND_OLD_VALUES is mapped as NEW_VALUES when generating avro files for Spanner Change Stream. This PR is target to correct the mapping, and use NEW_ROW_AND_OLD_VALUES as is in the generated avro file.

…D_VALUES for AVRO files

The capture type NEW_ROW_AND_OLD_VALUES is mapped as NEW_VALUES when generating avro files for Spanner Change Stream.
@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 NEW_ROW_AND_OLD_VALUES capture type within the Spanner Change Stream to Avro transformation pipeline. By updating both the internal mapping logic and the Avro schema definition, the system can now properly distinguish and process this capture type instead of defaulting to NEW_VALUES.

Highlights

  • Added Support for NEW_ROW_AND_OLD_VALUES: Updated the mapping logic to correctly handle the NEW_ROW_AND_OLD_VALUES capture type when generating Avro files for Spanner Change Streams.
  • Schema Update: Updated the datachangerecord.avsc schema to include NEW_ROW_AND_OLD_VALUES in the ValueCaptureType enum.
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.

@google-cla

google-cla Bot commented May 22, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ahlie88 ahlie88 changed the title [googlecloud-to-googlecloud] Add Spanner Capture Type: NEW_ROW_AND_OLD_VALUES for AVRO files [googlecloud-to-googlecloud] Add Spanner Capture Type: NEW_ROW_AND_OLD_VALUES for AVRO files May 22, 2026

@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 NEW_ROW_AND_OLD_VALUES capture type by updating the mapping logic in WriteDataChangeRecordsToAvro and the corresponding Avro schema definition. The reviewer recommends adding a unit test to verify the mapping for this new type, as existing tests are limited to the OLD_AND_NEW_VALUES type.

Comment on lines +213 to +214
case NEW_ROW_AND_OLD_VALUES:
return com.google.cloud.teleport.v2.ValueCaptureType.NEW_ROW_AND_OLD_VALUES;

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.

medium

The new capture type NEW_ROW_AND_OLD_VALUES is correctly added to the mapping. However, it is recommended to add a corresponding unit test in WriteDataChangeRecordsToAvroTest.java to verify that this new type is correctly mapped to the Avro equivalent. Currently, the existing tests only cover OLD_AND_NEW_VALUES.

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.

1 participant