Skip to content

Use getPayload instead of getOriginalPayload to process the UDF changes#3745

Open
le-michael wants to merge 3 commits intoGoogleCloudPlatform:mainfrom
le-michael:udf-get-payload
Open

Use getPayload instead of getOriginalPayload to process the UDF changes#3745
le-michael wants to merge 3 commits intoGoogleCloudPlatform:mainfrom
le-michael:udf-get-payload

Conversation

@le-michael
Copy link
Copy Markdown
Contributor

@le-michael le-michael commented Apr 30, 2026

Verified manually that applying a UDF works in transforming the data and excluding a UDF maintains the original payload.

Example UDF:

function process(inJson) {
	const message = JSON.parse(inJson);
	const data = JSON.parse(message.data);

	// Rename a field ping to pong
	if (data.ping) {
		data.pong = data.ping;
		delete data.ping;
	}

	// Add a field helloWorld
	data.helloWorld = "hello world";

	message.data = JSON.stringify(data);
	return JSON.stringify(message);
}

@le-michael le-michael requested a review from a team as a code owner April 30, 2026 02:35
@gemini-code-assist
Copy link
Copy Markdown

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 updates the data processing logic within the MongoDB to Firestore transformation pipeline. By switching to the processed payload, the system ensures that UDF (User Defined Function) modifications are correctly accounted for during the event context creation.

Highlights

  • Payload Processing Update: Updated the transformation logic to utilize getPayload() instead of getOriginalPayload() when parsing the JSON node for MongoDB change events.
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.

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.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

❌ Patch coverage is 14.28571% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.06%. Comparing base (cd28f9b) to head (e058fd8).
⚠️ Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
...ort/v2/templates/DataStreamMongoDBToFirestore.java 0.00% 6 Missing ⚠️

❌ Your patch check has failed because the patch coverage (14.28%) 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    #3745      +/-   ##
============================================
+ Coverage     52.91%   53.06%   +0.15%     
- Complexity     6346     6428      +82     
============================================
  Files          1069     1070       +1     
  Lines         64648    64941     +293     
  Branches       7165     7193      +28     
============================================
+ Hits          34206    34459     +253     
- Misses        28141    28167      +26     
- Partials       2301     2315      +14     
Components Coverage Δ
spanner-templates 72.85% <ø> (+<0.01%) ⬆️
spanner-import-export 68.61% <ø> (-0.03%) ⬇️
spanner-live-forward-migration 80.98% <ø> (-0.02%) ⬇️
spanner-live-reverse-replication 77.19% <ø> (-0.22%) ⬇️
spanner-bulk-migration 91.13% <ø> (+0.02%) ⬆️
gcs-spanner-dv 85.81% <ø> (-0.02%) ⬇️
Files with missing lines Coverage Δ
.../transforms/CreateMongoDbChangeEventContextFn.java 100.00% <100.00%> (ø)
...ort/v2/templates/DataStreamMongoDBToFirestore.java 16.32% <0.00%> (-0.14%) ⬇️

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

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