Skip to content

Add spannerChangeStreamTvfNameList parameters for 3 change stream templates#3838

Open
tianz101 wants to merge 3 commits into
GoogleCloudPlatform:mainfrom
tianz101:main
Open

Add spannerChangeStreamTvfNameList parameters for 3 change stream templates#3838
tianz101 wants to merge 3 commits into
GoogleCloudPlatform:mainfrom
tianz101:main

Conversation

@tianz101
Copy link
Copy Markdown
Contributor

We are adding spannerChangeStreamTvfNameList paramter to allow users to
specify the change stream to query or the list of tvf names to query.

@tianz101 tianz101 requested a review from a team as a code owner May 20, 2026 21:22
@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 a new configuration parameter, spannerChangeStreamTvfNameList, across three Spanner Change Streams templates. This addition enables users to define a custom list of Table-Valued Function (TVF) names to be queried and unioned, providing greater flexibility in data ingestion pipelines. Additionally, the project's Apache Beam dependency has been updated to version 2.74.0.

Highlights

  • New Configuration Parameter: Added the spannerChangeStreamTvfNameList parameter to allow users to specify a colon-separated list of change stream TVF names for querying and unioning.
  • Template Updates: Updated Spanner Change Streams to BigQuery, GCS, and Pub/Sub templates to support the new TVF name list configuration.
  • Dependency Update: Upgraded Apache Beam version from 2.73.0 to 2.74.0 in the project's pom.xml.
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.

Copy link
Copy Markdown
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 updates Beam dependencies to version 2.74.0 and introduces a new spannerChangeStreamTvfNameList parameter to the Spanner change stream templates for BigQuery, GCS, and Pub/Sub. This allows for querying and unioning multiple TVF names. Feedback includes correcting a recurring typo ('glound' to 'Google Cloud') in the parameter help text across several files and removing a redundant null check in the BigQuery template logic.

String tvfNameListString = options.getSpannerChangeStreamTvfNameList();
if (tvfNameListString != null && !tvfNameListString.isEmpty()) {
List<String> tvfNameList = Arrays.asList(tvfNameListString.split(":"));
if (tvfNameList != null && !tvfNameList.isEmpty()) {
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 null check for tvfNameList is redundant because Arrays.asList never returns null. Mandatory parameters should be validated at the entry point to avoid redundant null checks downstream.

Suggested change
if (tvfNameList != null && !tvfNameList.isEmpty()) {
if (!tvfNameList.isEmpty()) {
References
  1. Ensure that mandatory parameters are validated for nullability at the entry point or in upstream components to prevent NullPointerExceptions, avoiding the need for redundant null checks.

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.

Arrays.asList() never returns null in Java. We can use if (!tvfNameList.isEmpty()) { here directly.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 4, 2026

Codecov Report

❌ Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.50%. Comparing base (a1ca8e0) to head (2b910fc).

Files with missing lines Patch % Lines
...leport/v2/templates/SpannerChangeStreamsToGcs.java 0.00% 6 Missing ⚠️
...ort/v2/templates/SpannerChangeStreamsToPubSub.java 0.00% 6 Missing ⚠️
...eamstobigquery/SpannerChangeStreamsToBigQuery.java 0.00% 5 Missing ⚠️

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@              Coverage Diff              @@
##               main    #3838       +/-   ##
=============================================
+ Coverage     33.99%   55.50%   +21.51%     
- Complexity      501     6573     +6072     
=============================================
  Files           215     1103      +888     
  Lines         13074    67605    +54531     
  Branches       1290     7587     +6297     
=============================================
+ Hits           4444    37522    +33078     
- Misses         8274    27667    +19393     
- Partials        356     2416     +2060     
Components Coverage Δ
spanner-templates 88.30% <ø> (∅)
spanner-import-export 68.52% <ø> (∅)
spanner-live-forward-migration 90.19% <ø> (∅)
spanner-live-reverse-replication 83.94% <ø> (∅)
spanner-bulk-migration 92.60% <ø> (∅)
gcs-spanner-dv 88.97% <ø> (∅)
Files with missing lines Coverage Δ
...eamstobigquery/SpannerChangeStreamsToBigQuery.java 0.00% <0.00%> (ø)
...leport/v2/templates/SpannerChangeStreamsToGcs.java 0.00% <0.00%> (ø)
...ort/v2/templates/SpannerChangeStreamsToPubSub.java 0.00% <0.00%> (ø)

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

tianz101 and others added 2 commits June 5, 2026 19:34
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@tianz101 tianz101 force-pushed the main branch 4 times, most recently from 192e8af to ae6b6c5 Compare June 5, 2026 20:06
String tvfNameListString = options.getSpannerChangeStreamTvfNameList();
if (tvfNameListString != null && !tvfNameListString.isEmpty()) {
List<String> tvfNameList = Arrays.asList(tvfNameListString.split(":"));
if (tvfNameList != null && !tvfNameList.isEmpty()) {
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.

Arrays.asList() never returns null in Java. We can use if (!tvfNameList.isEmpty()) { here directly.


String tvfNameListString = options.getSpannerChangeStreamTvfNameList();
if (tvfNameListString != null && !tvfNameListString.isEmpty()) {
List<String> tvfNameList = Arrays.asList(tvfNameListString.split(";"));
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.

Issue: If a user provides input like tvf1;tvf2; (with a trailing semicolon), the split() method will create an empty string as the last element:

"tvf1;tvf2;".split(";") // Results in: ["tvf1", "tvf2", ""]

Recommendation: Filter out empty strings:
List tvfNameList = Arrays.stream(tvfNameListString.split(";"))
.filter(name -> !name.trim().isEmpty())
.collect(Collectors.toList());

@jiangzzhu
Copy link
Copy Markdown
Contributor

There is spotless format check failure. Need to run

mvn spotless:apply

to format changes.

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.

2 participants