Skip to content

Conversation

@brfrn169
Copy link
Collaborator

@brfrn169 brfrn169 commented Nov 23, 2025

Description

This PR addresses the semantic ambiguity that arises when PUT or DELETE operations with IS_NULL conditions on right source table columns are performed on LEFT_OUTER virtual tables. In LEFT_OUTER joins, it's impossible to distinguish between a record with NULL values versus a missing record on the right side. This PR introduces operation attributes to control the behavior of such operations.

In LEFT_OUTER joins, when querying with IS_NULL conditions on right table columns, we cannot distinguish between:

  1. A record exists on the right side with NULL values
  2. No record exists on the right side at all (thus NULL due to LEFT_OUTER join)

This ambiguity makes conditional mutations semantically unclear. This PR provides:

  • Safe defaults: PutIfNotExists conversion for PUT (common case), disallow for DELETE (safety)
  • Flexibility: Operation attributes allow users to override defaults when needed

Related issues and/or PRs

N/A

Changes made

  1. New Operation Attributes (JdbcOperationAttributes)
  • Introduced a new utility class JdbcOperationAttributes with two operation attributes:
    • jdbc-left-outer-virtual-table-put-if-is-null-on-right-columns-conversion-enabled (default: true)
      • Controls whether PUT operations with all IS_NULL conditions on right table columns should be converted to PutIfNotExists
      • When enabled (default), assumes the common use case is checking that the right-side record does not exist
      • When disabled, preserves the original IS_NULL conditions as PutIf
    • jdbc-left-outer-virtual-table-delete-if-is-null-on-right-columns-allowed (default: false)
      • Controls whether DELETE operations with all IS_NULL conditions on right table columns are allowed
      • When disabled (default), throws an exception to prevent semantically ambiguous operations
      • When enabled, preserves the original IS_NULL conditions as DeleteIf
  1. JdbcDatabase Logic Updates
  • Added logic to detect when all conditions on right source table columns are IS_NULL in LEFT_OUTER joins
  • For PUT operations: converts to PutIfNotExists by default (attribute-controlled)
  • For DELETE operations: disallows by default and throws exception (attribute-controlled)
  • Mixed conditions (IS_NULL + other conditions) are always preserved as-is

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • I have considered whether similar issues could occur in other products, components, or modules if this PR is for bug fixes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

N/A

Release notes

N/A

@brfrn169 brfrn169 self-assigned this Nov 23, 2025
Copilot AI review requested due to automatic review settings November 23, 2025 16:45
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @brfrn169, 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 resolves a semantic ambiguity that arises in LEFT_OUTER virtual tables when PUT or DELETE operations include IS_NULL conditions on columns from the right source table. It introduces a mechanism using new operation attributes to explicitly control how these ambiguous scenarios are handled, providing safe default behaviors while allowing users to override them when necessary.

Highlights

  • Introduced Operation Attributes: A new JdbcOperationAttributes class and two new attributes (jdbc-left-outer-virtual-table-put-if-is-null-on-right-columns-conversion-enabled and jdbc-left-outer-virtual-table-delete-if-is-null-on-right-columns-allowed) were added to provide explicit control over operations on LEFT_OUTER virtual tables.
  • Modified PUT Operations Handling: For PUT operations on LEFT_OUTER virtual tables where all conditions on right-side columns are IS_NULL, the system now defaults to converting these to PutIfNotExists. This behavior can be toggled via the new put-if-is-null-conversion-enabled attribute.
  • Modified DELETE Operations Handling: For DELETE operations on LEFT_OUTER virtual tables with all IS_NULL conditions on right-side columns, the operation is now disallowed by default, throwing an IllegalArgumentException to prevent ambiguous deletions. This can be overridden using the delete-if-is-null-allowed attribute.
  • New Error Type: A new CoreError constant, DELETE_IF_IS_NULL_FOR_RIGHT_SOURCE_TABLE_NOT_ALLOWED_FOR_LEFT_OUTER_VIRTUAL_TABLES, was added to support the new default behavior for DELETE operations.
  • Comprehensive Testing: New unit tests were added for both the JdbcDatabase logic and the JdbcOperationAttributes utility class to ensure the correct implementation and handling of the new attributes and behaviors.
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.

Copy link
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 provides a well-designed solution to address the semantic ambiguity of IS_NULL conditions on the right-side table of LEFT_OUTER virtual tables. The introduction of operation attributes with safe defaults is a robust approach. The implementation is clear, and the accompanying tests are thorough, covering various scenarios. I have a couple of suggestions to enhance code maintainability and consistency.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot finished reviewing on behalf of brfrn169 November 23, 2025 18:41
@brfrn169 brfrn169 requested a review from Copilot November 23, 2025 23:05
Copilot finished reviewing on behalf of brfrn169 November 23, 2025 23:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

Copy link
Contributor

@komamitsu komamitsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@brfrn169 brfrn169 merged commit d4a3a97 into master Nov 25, 2025
136 of 140 checks passed
@brfrn169 brfrn169 deleted the revisit-handling-is-null-conditions-in-left-outer-virtual-tables branch November 25, 2025 05:58
feeblefakie pushed a commit that referenced this pull request Nov 25, 2025
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.

4 participants