Skip to content

Conversation

maple525866
Copy link
Contributor

@maple525866 maple525866 commented Sep 29, 2025

Ⅰ. Describe what this PR did

  1. Problem Background
    Seata cannot support Oracle's INSERT ALL batch insert statements. For example, insert all into a (id) values(1) into a (id) values(2) SELECT 1 FROM DUAL will be parsed as OracleMultiInsertStatement, but DruidSQLRecognizerFactoryImpl does not support this statement type.

  2. Solution

  • Extend DruidSQLRecognizerFactoryImpl to add support for OracleMultiInsertStatement
  • Extend OracleOperateRecognizerHolder to add methods specifically for handling multiple inserts
  • Create OracleMultiInsertRecognizer and use ast.getEntries() to obtain insert items. It supports parsing multiple INSERT INTO clauses and correctly handles various data types (NULL, parameter placeholders, sequences, etc.)
  1. Verification Functionality -> Created OracleMultiInsertRecognizerTest containing 11 test cases:
  • Basic functional testing: SQL type, table name, table alias
  • Column processing testing: Insert column retrieval, empty column detection
  • Data row testing: Basic data, NULL values, parameter placeholders, primary key processing
  • Complex scenario testing: Multi-table inserts, complex statements, edge cases
  • Interface consistency testing: Ensures compliance with the Seata interface specification

Ⅱ. Does this pull request fix one issue?

fixes #7607

Ⅲ. Why don't you add test cases (unit test/integration test)?

UT have been added

Ⅳ. Describe how to verify it

mvn clean test

Ⅴ. Special notes for reviews

Currently, only single-table Oracle INSERT batching is supported. I don't believe multi-table support is necessary because branching transactions can be useful.❤️

Copy link

codecov bot commented Sep 29, 2025

Codecov Report

❌ Patch coverage is 66.34615% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.25%. Comparing base (b6af418) to head (ecd619b).

Files with missing lines Patch % Lines
...rser/druid/oracle/OracleMultiInsertRecognizer.java 68.04% 19 Missing and 12 partials ⚠️
...sqlparser/druid/DruidSQLRecognizerFactoryImpl.java 50.00% 2 Missing and 1 partial ⚠️
...er/druid/oracle/OracleOperateRecognizerHolder.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7675      +/-   ##
============================================
- Coverage     61.29%   61.25%   -0.04%     
  Complexity      666      666              
============================================
  Files          1314     1315       +1     
  Lines         49853    49957     +104     
  Branches       5874     5899      +25     
============================================
+ Hits          30556    30601      +45     
- Misses        16516    16563      +47     
- Partials       2781     2793      +12     
Files with missing lines Coverage Δ
...er/druid/oracle/OracleOperateRecognizerHolder.java 87.50% <0.00%> (-12.50%) ⬇️
...sqlparser/druid/DruidSQLRecognizerFactoryImpl.java 81.81% <50.00%> (-5.03%) ⬇️
...rser/druid/oracle/OracleMultiInsertRecognizer.java 68.04% <68.04%> (ø)

... and 7 files with indirect coverage changes

Impacted file tree graph

🚀 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.

Copy link
Contributor

Choose a reason for hiding this comment

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

By default, only the insert all syntax of Oracle Batch Insert and the same column situation is supported. The same effect can be achieved by adding multiple values ​​clauses to a normal insert. Are there plans to support more in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, we only support batch insert of multiple columns (same columns) in a single table. We will continue to support this in the future.

@maple525866
Copy link
Contributor Author

maple525866 commented Oct 2, 2025

First, thanks to @YoWuwuuuw for the bug report.❤️

For now, I think we can start with basic support, like this pull request, which supports batch inserts for multiple columns in a single table.

However, for other scenarios, such as support for insert-first syntax and ConditionalInsertClause, further support can be implemented through other pull requests.

For multi-table scenarios, I don't think support is necessary at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Oracle Batch Insert Not Support
2 participants