feat(datastream-to-SQL): Support DELETE replication for tables without Primary Keys using ROWID - #4232
feat(datastream-to-SQL): Support DELETE replication for tables without Primary Keys using ROWID#4232yonatandt wants to merge 9 commits into
Conversation
Summary of ChangesHello, 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 addresses a regression in the DatastreamToDML component where DELETE events for tables without primary keys were failing due to empty WHERE clauses. By implementing a ROWID fallback mechanism, the system can now correctly identify and process these deletions. Additionally, the changes improve the robustness of metadata field handling within DatastreamRow to ensure more reliable data processing. Highlights
Using Gemini Code AssistThe 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
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 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
|
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (78.57%) 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 #4232 +/- ##
=========================================
Coverage 56.35% 56.36%
- Complexity 7858 7875 +17
=========================================
Files 1154 1154
Lines 73194 73270 +76
Branches 8580 8606 +26
=========================================
+ Hits 41252 41295 +43
- Misses 29158 29177 +19
- Partials 2784 2798 +14
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request introduces null-safety improvements in DatastreamRow when parsing JSON fields and primary keys, and adds fallback support for row IDs (rowid or _metadata_row_id) when generating DML templates and filters in DatastreamToDML for tables without primary keys. The feedback recommends handling column casing in the row ID fallback logic of getValueSql to prevent issues when casing rules are applied, and refactoring the primary key extraction in DatastreamRow to avoid redundant JSON node lookups.
da8f43e to
20c621d
Compare
- Fix regression in DatastreamToDML where tables lacking primary keys produced empty WHERE clauses for DELETE events. - Add ROWID fallback in getPrimaryKeyToValueFilterSql when primaryKeys is empty or unmapped. - Allow getDmlTemplate to generate DELETE DML when rowid or _metadata_row_id is present. - Make DatastreamRow getPrimaryKeys and getStringValue null-safe against missing metadata fields. - Add unit tests verifying ROWID fallback in DatastreamToDMLTest and DatastreamRowTest. Fixes b/506993545
…optimize primary key lookup
…achieve 100% patch coverage
…fallback WHERE filter
255c22e to
72f2afb
Compare
…ination rowid primary key
…etPrimaryKeyToValueFilterSql
03afd40 to
c2bc81b
Compare
Fixes b/506993545