Skip to content

Conversation

@tinaspark
Copy link

@tinaspark tinaspark commented Nov 17, 2025

Add import/export support for ON UPDATE (PENDING_COMMIT_TIMESTAMP()) expressions

@tinaspark tinaspark requested a review from a team as a code owner November 17, 2025 21:06
@tinaspark tinaspark marked this pull request as draft November 17, 2025 21:07
@gemini-code-assist
Copy link

Summary of Changes

Hello @tinaspark, 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 significantly enhances Google Cloud Teleport's Spanner DDL capabilities by adding full support for ON UPDATE expressions on columns. This feature is crucial for scenarios requiring automatic column value updates upon row modification, such as maintaining 'last modified' timestamps. The changes ensure that ON UPDATE expressions are seamlessly handled throughout the DDL conversion process, from Avro schemas to Spanner DDL, and are correctly recognized when scanning existing database schemas.

Highlights

  • ON UPDATE Expression Support: Introduced comprehensive support for ON UPDATE expressions in Spanner DDL, allowing columns to automatically update their values based on a specified expression when a row is modified.
  • Avro Schema Integration: Modified AvroSchemaToDdlConverter and DdlToAvroSchemaConverter to correctly parse and generate onUpdateExpression properties within Avro schemas, ensuring round-trip compatibility.
  • DDL Representation and Generation: Updated the Column DDL builder to include onUpdateExpression and enhanced the prettyPrint method to correctly render the ON UPDATE clause in generated DDL statements for both Google Standard SQL and PostgreSQL dialects.
  • Information Schema Scanning: Adjusted InformationSchemaScanner to fetch and interpret on_update_expression from Spanner's information_schema.columns, enabling accurate DDL reconstruction from existing databases.
  • Extensive Testing: Added new and updated existing unit and integration tests across various components to validate the correct behavior of ON UPDATE expressions, particularly for commit timestamp columns, in both Google Standard SQL and PostgreSQL environments.
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.

@tinaspark tinaspark marked this pull request as ready for review November 18, 2025 15:17
@tinaspark
Copy link
Author

please note that I am unable to fully run mvn verify due to b/452167951. I have attempted to run as many tests locally 1 by 1 as I can

@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.24%. Comparing base (4e678c1) to head (2b9512b).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##               main    #2999    +/-   ##
==========================================
  Coverage     50.23%   50.24%            
- Complexity     5003     5024    +21     
==========================================
  Files           966      967     +1     
  Lines         59163    59273   +110     
  Branches       6449     6463    +14     
==========================================
+ Hits          29722    29779    +57     
- Misses        27333    27388    +55     
+ Partials       2108     2106     -2     
Components Coverage Δ
spanner-templates 70.40% <100.00%> (-0.04%) ⬇️
spanner-import-export 68.92% <100.00%> (-0.06%) ⬇️
spanner-live-forward-migration 79.69% <ø> (ø)
spanner-live-reverse-replication 77.03% <ø> (-0.05%) ⬇️
spanner-bulk-migration 88.33% <ø> (ø)
Files with missing lines Coverage Δ
...oud/teleport/spanner/AvroSchemaToDdlConverter.java 86.77% <100.00%> (+0.14%) ⬆️
...va/com/google/cloud/teleport/spanner/AvroUtil.java 93.75% <ø> (ø)
...oud/teleport/spanner/DdlToAvroSchemaConverter.java 97.51% <100.00%> (+0.64%) ⬆️
.../com/google/cloud/teleport/spanner/ddl/Column.java 85.59% <100.00%> (+0.63%) ⬆️

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

@tinaspark
Copy link
Author

The failure from the integration tests:

[Thread-3] INFO org.apache.beam.it.gcp.TemplateTestBase - [ERROR] Failed to execute goal com.google.cloud.teleport:templates-maven-plugin:1.0-SNAPSHOT:stage (default) on project template-python: Template staging failed: Image gcr.io/cloud-teleport-testing/yaml-template:2025-11-20-18-19-41_IT was not created properly. Check the build logs for more details. -> [Help 1]
[Thread-3] INFO org.apache.beam.it.gcp.TemplateTestBase - org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.teleport:templates-maven-plugin:1.0-SNAPSHOT:stage (default) on project template-python: Template staging failed
...
...
...
Error: Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 156.778 s <<< FAILURE! - in com.google.cloud.teleport.templates.python.YAMLTemplateIT
[INFO] Running com.google.cloud.teleport.templates.python.PubSubToBigQueryYamlIT
[pool-1-thread-5] INFO org.apache.beam.it.gcp.dataflow.AbstractPipelineLauncher - Cleaning up Dataflow jobs...
[pool-1-thread-5] INFO org.apache.beam.it.gcp.dataflow.AbstractPipelineLauncher - Dataflow jobs successfully cleaned up.
[pool-1-thread-5] INFO org.apache.beam.it.gcp.storage.GcsResourceManager - managed temp dir size : 1
[pool-1-thread-5] INFO org.apache.beam.it.gcp.storage.GcsResourceManager - Cleaning up everything under 'PubSubToBigQueryYamlIT/20251120-0df8644f-f4a2-46b1-a397-7aa59a4fe6e1' under bucket 'cloud-teleport-testing-it-gitactions'
Error: Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 156.786 s <<< FAILURE! - in com.google.cloud.teleport.templates.python.PubSubToBigQueryYamlIT
[INFO] Running com.google.cloud.teleport.templates.python.WordCountPythonIT
Warning: Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 s - in com.google.cloud.teleport.templates.python.WordCountPythonIT
[INFO]
[INFO] Results:
[INFO]
Error: Errors:
Error: JdbcToBigQueryYamlIT>TemplateTestBase.setUpBase:253->TemplateTestBase.getSpecPath:306 » UncheckedExecution
Error: JdbcToBigQueryYamlIT>TemplateTestBase.setUpBase:253->TemplateTestBase.getSpecPath:306 » UncheckedExecution
Error: PubSubToBigQueryYamlIT>TemplateTestBase.setUpBase:253->TemplateTestBase.getSpecPath:306 » UncheckedExecution
Error: YAMLTemplateIT>TemplateTestBase.setUpBase:253->TemplateTestBase.getSpecPath:306 » UncheckedExecution
Error: YAMLTemplateIT>TemplateTestBase.setUpBase:253->TemplateTestBase.getSpecPath:306 » UncheckedExecution
[INFO]
Error: Tests run: 6, Failures: 0, Errors: 5, Skipped: 1

I can't tell if the failure is related to the PR or if the test is just flaky

@tinaspark tinaspark marked this pull request as draft November 24, 2025 19:02
@tinaspark
Copy link
Author

moving back to draft until the new INFORMATION_SCHEMA columns are shipped to cloud in 36.6

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants