DanielLeens opened a new pull request, #13502:
URL: https://github.com/apache/seatunnel/pull/13502

   Yes, I am contributing to Apache SeaTunnel.
   
   Fixes #13499.
   
   ### Purpose of this pull request
   
   Oracle short CLOB/NCLOB/BLOB values are bound through stream setters, but 
their NULL values use LOB-typed binders. With ojdbc8 12.2.0.1 this switches 
bind families and fragments successful batches. In a real-driver regression 
case, 1,000 rows in 10 batches require 136 SQL*Net round trips before this 
change and 21 afterward.
   
   Add a stateless Oracle generated-DML converter that binds CLOB STRING NULL 
as VARCHAR, NCLOB STRING NULL with setNString(null), and BLOB BYTES NULL with 
setBytes(null). All non-null values and all other NULL types delegate to the 
existing converter. In particular, retain the non-null stream handling 
introduced by #10118; do not introduce a character-length cutoff or revert all 
of #10768.
   
   Select it only for generated INSERT, MERGE and INSERT/UPDATE paths using the 
exact OracleDialect class. Leave custom SQL, DELETE, reads, OceanBase Oracle 
and other Oracle subclasses on their existing converters. A real custom-SQL 
overloaded VARCHAR2/CLOB function probe confirms that changing custom-query 
NULL types would change function dispatch.
   
   ### Does this PR introduce any user-facing change?
   
   Yes: faster generated Oracle DML when short LOB values alternate with NULL. 
Existing configuration names/defaults, API/SPI contracts and stored values 
remain compatible. OracleDialect and OracleJdbcRowConverter class bytes are 
unchanged, preserving their existing serialization forms. The new converter has 
an explicit serialVersionUID.
   
   Update the English and Chinese Oracle sink documentation with the 
generated-SQL/custom-query boundary. No dependency, POM, connector registration 
or packaging configuration change is needed.
   
   ### How was this patch tested?
   
   Java 11, synthetic data, same Linux x86_64 host and isolated Oracle XE 
11.2.0.2; ojdbc8 12.2.0.1, AL32UTF8 / AL16UTF16. The shared host has 4 vCPU / 
16 GiB; Oracle is capped at 2 CPU / 2 GiB. This measures real JDBC connector 
components, not full Zeta/DataX engine throughput.
   
   Each throughput trial separately warms 100,000 rows and copies 1,000,000 
measured rows. Batch size 1000, manual commit per successful batch, retries 0, 
exact destination reconciliation outside System.nanoTime timing. Original DataX 
and SeaTunnel trials alternate order; DataX uses its declared dependencies 
first in a separate JVM. Sources: SeaTunnel dev 
ee0fb0d72f67edbcd6caf08360fd354fa68e002f and DataX master 
5993b26cda90f3e6a4a2fd2e42843efeb770ab3d. Full baseline details are in #13499.
   
   | Generated CLOB + sparse NULL | Round 1 rows/s | Round 2 rows/s | Round 3 
rows/s |
   | --- | ---: | ---: | ---: |
   | Original SeaTunnel | 14963.109 | 14983.311 | 15076.664 |
   | This PR | 22800.971 | 23211.658 | 23213.670 |
   | DataX reference | 24741.041 | 24875.319 | 25109.346 |
   
   All destinations match exactly. Median SeaTunnel throughput improves by 
54.92%; the remaining median DataX/SeaTunnel ratio is 1.07167. Additional 
generated-DML candidate million-row trials all reconcile exactly: NCLOB 
23655.206 / 23103.576 / 23656.718; BLOB 23781.573 / 24136.221 / 23828.261 
rows/s. Their original baselines used explicit INSERT SQL, so these are not 
presented as separately matched generated-SQL before/after percentages.
   
   Extend the existing JdbcOracleIT; do not add a new test class:
   
   - testSparseLobNullsKeepRoundTripsBatchScaled: real-driver system-statistics 
ceiling catches batch fragmentation without wall-clock timing assertions. 
Baseline fails at 136; candidate passes at 21, limit 60.
   - testGeneratedDmlWithLobNullTransitions: NULL-first/null-only batches, 
empty values, Chinese/supplementary characters, long CLOB/NCLOB/BLOB through 
65,536 UTF-16 units/bytes, INSERT/UPDATE, and supported short-value MERGE 
insert/update; verifies every ID and full value.
   - testCustomSqlPreservesLobNullOverload: unrestricted custom SQL continues 
selecting the CLOB overload for a CLOB NULL parameter.
   
   Replayed the actual three added IT method bodies against the existing 
isolated Oracle by adapting only fixture URL/user/bootstrap wiring (plus 
diagnostic printing). Original supported-value/custom-query checks pass; the 
original performance assertion fails as expected; all candidate checks pass. 
The test user in the existing Oracle IT initialization already has DBA 
privileges for v$mystat diagnostics; production writes do not access system 
statistics.
   
   Long-heavy controls use 1,000 warmup + 10,000 reconciled rows per probe, 
65,536 UTF-16 units/bytes and approximately 1/17 NULLs. Both baseline-first and 
candidate-first orders were checked. In the reverse order, candidate versus 
baseline throughput differs by -0.76% CLOB, -1.37% NCLOB and +0.05% BLOB. These 
are diagnostic controls, not million-row qualification trials or claims of 
general long-LOB speedup.
   
   Executed successfully (all Maven commands include -nsu 
-Dmaven.gitcommitid.skip=true -T 3C):
   
   - ./mvnw spotless:apply -pl 
seatunnel-connectors-v2/connector-jdbc,seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-1
   - ./mvnw -q -DskipTests verify -pl seatunnel-connectors-v2/connector-jdbc -am
   - ./mvnw test -pl seatunnel-connectors-v2/connector-jdbc 
-Dtest=OracleJdbcRowConverterTest,JdbcOutputFormatBuilderTest,org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.oracle.OracleDialectTest
 (13 passed)
   - ./mvnw -DskipTests -Dskip.ui=true package -pl 
'seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-1,!seatunnel-engine/seatunnel-engine-ui'
 -am
   
   The final packaged production classes match the remotely tested candidate 
byte-for-byte. No engine UI source is changed. The final E2E reactor explicitly 
excludes that module and reuses its already-built metadata-only JAR (zero 
executable classes) from the same unchanged source baseline to resolve the 
backend dependency. Its SHA256 is 
7a0e3cebca50d2c1cec6943d2b26078c84d3673855bc02bf2e20a653412d6914. Unaffected 
engine scheduling/checkpoint paths are outside the benchmark.
   
   Validation limits: the full Testcontainers/Zeta lifecycle was not run 
locally because the local Docker API returns HTTP 500. An overly broad 
OracleDialectTest selector also selected the container-backed class and failed 
for that environment reason; the corrected fully qualified key-test selection 
passes. An initial reactor test-compile stopped before the config shade package 
phase; package -am resolves it without a POM change. Full normal E2E lifecycle 
remains for CI. Long MERGE on Oracle11g/ojdbc12.2 produces ORA-01461 in both 
baseline and candidate; this existing limitation is not claimed to be fixed.
   
   ### Check list
   
   - [x] Existing JDBC tests extended with real-driver regression and 
compatibility assertions.
   - [x] English and Chinese documentation updated.
   - [x] No new JAR dependencies, binary files, config defaults, public SPI 
changes or unrelated deletions.
   - [x] Existing connector factory/SPI/plugin mapping/dist registrations 
remain intact; no new connector is introduced.
   - [x] Open/closed and author-specific duplicate searches repeated before 
submission; historical #10118/#10768 address different behavior and are 
preserved.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to