Skip to content

Conversation

@cjac
Copy link

@cjac cjac commented Nov 22, 2025

This commit enhances the Oracle Sink plugin to support MERGE operations, providing an idempotent way to handle data writes, especially in scenarios involving Spark task retries.

New Features:

  • UPSERT Operation: A new operation property in the sink configuration allows users to specify "upsert".
  • Merge Keys: A mergeKeys property is introduced to define the column(s) for the MERGE statement's ON clause.
  • OracleETLDBOutputFormat: A new class extending ETLDBOutputFormat to construct the Oracle-specific MERGE SQL statement using a USING DUAL approach.
  • Conditional Logic: The sink now conditionally uses OracleETLDBOutputFormat when the "upsert" operation is selected.

Test Improvements:

  • Updated docker-compose.yml to use container-registry.oracle.com/database/free:latest with healthcheck.
  • README.md updated to reflect new Oracle image and Podman instructions.
  • Increased test timeout in DatabasePluginTestBase.
  • Added testDBSinkUniqueConstraintViolation to OracleSinkTestRun to demonstrate ORA-00001 on duplicate INSERTs.
  • Added testDBSinkMerge to OracleSinkTestRun to validate the new UPSERT functionality.
  • Commented out apache-rat-plugin in the root pom.xml to potentially speed up local builds.

This change addresses issues where task retries could lead to unique constraint violations (ORA-00001) by providing a true upsert mechanism.

This commit enhances the Oracle Sink plugin to support `MERGE` operations, providing an idempotent way to handle data writes, especially in scenarios involving Spark task retries.

New Features:

-   **UPSERT Operation:** A new `operation` property in the sink configuration allows users to specify "upsert".
-   **Merge Keys:** A `mergeKeys` property is introduced to define the column(s) for the `MERGE` statement's `ON` clause.
-   **`OracleETLDBOutputFormat`:** A new class extending `ETLDBOutputFormat` to construct the Oracle-specific `MERGE` SQL statement using a `USING DUAL` approach.
-   **Conditional Logic:** The sink now conditionally uses `OracleETLDBOutputFormat` when the "upsert" operation is selected.

Test Improvements:

-   Updated `docker-compose.yml` to use `container-registry.oracle.com/database/free:latest` with healthcheck.
-   README.md updated to reflect new Oracle image and Podman instructions.
-   Increased test timeout in `DatabasePluginTestBase`.
-   Added `testDBSinkUniqueConstraintViolation` to `OracleSinkTestRun` to demonstrate ORA-00001 on duplicate INSERTs.
-   Added `testDBSinkMerge` to `OracleSinkTestRun` to validate the new UPSERT functionality.
-   Commented out `apache-rat-plugin` in the root `pom.xml` to potentially speed up local builds.

This change addresses issues where task retries could lead to unique constraint violations (ORA-00001) by providing a true upsert mechanism.
@cjac cjac marked this pull request as draft November 27, 2025 04:51
@cjac
Copy link
Author

cjac commented Nov 27, 2025

Internal notes:

go/sf/64273740
b/458793088

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.

1 participant