[#12846] feat(spark-connector): Add governed Apache Doris batch read and write support - #12902
Draft
jiangxt2 wants to merge 4 commits into
Draft
[#12846] feat(spark-connector): Add governed Apache Doris batch read and write support#12902jiangxt2 wants to merge 4 commits into
jiangxt2 wants to merge 4 commits into
Conversation
…support Signed-off-by: jiangxt2 <jiangxt2@vip.qq.com>
Signed-off-by: jiangxt2 <jiangxt2@vip.qq.com>
Signed-off-by: jiangxt2 <jiangxt2@vip.qq.com>
…or handling Signed-off-by: jiangxt2 <jiangxt2@vip.qq.com>
Contributor
Author
Supplemental functional Docker evidenceI ran additional functional characterization against the current PR head (
The exact answer to the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This pull request adds an opt-in governed Apache Doris batch read and write adapter for
jdbc-doriscatalogs in the Spark 3.5 connector on Scala 2.12.The adapter preserves Gravitino authorization and credential vending, validates the Gravitino logical schema against Doris FE and JDBC physical metadata, and selects either the official Doris tablet reader or Spark JDBC V2 according to the query semantics. Predicates over normalized Doris columns remain Spark residuals with Spark-visible String semantics, and unsupported schema or planner combinations fail closed.
Governed writes support batch append and a separately enabled full-table truncate overwrite. They require
MODIFY_TABLEauthorization before physical Doris access, validate the exact writable schema, delegate to the official Doris Stream Load writer, force 2PC and strict safety options, and reject streaming, predicate overwrite, dynamic overwrite, row-level operations, and Spark catalog DDL.The change also adds the Doris Server Catalog property contract, strict vended-credential handling for specialized mode, a Spark version gate, a documented Doris release boundary, compile-only external connector dependencies, documentation, unit tests, and real Doris integration tests.
The Spark 3.5 module owns the Doris Connector compile/test dependency and positive classpath coverage, while
spark-commonhas no Doris version-specific dependency. Physical-schema validation preserves internal FE/JDBC drift details, while external JDBC failures expose only sanitized SQLState and vendor-code diagnostics without retaining raw, potentially credential-bearing causes.Why are the changes needed?
The existing generic JDBC fallback does not provide a Doris-specific contract for tablet reads, JDBC-lossy Doris types, physical-schema drift, mixed native/JDBC pushdown semantics, or governed Stream Load writes. This change provides that contract without changing the default
jdbc-dorisbehavior or the behavior of MySQL, PostgreSQL, and other JDBC providers.Fix: #12846
Does this PR introduce any user-facing change?
Yes.
spark.sql.gravitino.enableDorisSupport=trueopts into the specialized adapter; the default remainsfalse, which preserves generic JDBC behavior.jdbc-url,jdbc-driver,doris-fenodes, anddoris-query-port, plus a vendedJdbcCredential; configuredjdbc-userandjdbc-passwordare not accepted as specialized Spark connection credentials.doris-write-mode=batchenables governed append, anddoris-write-overwrite-mode=truncateseparately enables non-atomic full-table truncate overwrite. Both remain disabled by default.doris-jdbc-partition-column,doris-jdbc-lower-bound,doris-jdbc-upper-bound,doris-jdbc-num-partitions, anddoris-jdbc-fetch-sizeand validates the positive-integer fields. Specialized Spark catalog initialization additionally requires all four partition options to be present together and revalidates positive-integer values.How was this patch tested?
Current-head checks:
./gradlew :spark-connector:spark-common:test --tests org.apache.gravitino.spark.connector.plugin.TestGravitinoDriverPlugin -PskipITs— passed 11 tests without a Doris Connector dependency inspark-common../gradlew :spark-connector:spark-3.5:test --tests org.apache.gravitino.spark.connector.plugin.TestDorisSparkVersionGate35 --tests org.apache.gravitino.spark.connector.jdbc.doris.TestDorisTableCatalog35 --tests org.apache.gravitino.spark.connector.plugin.TestGravitinoDriverPlugin -PskipITs— passed 4 Spark 3.5-specific tests; common plugin coverage is reported separately above../gradlew :spark-connector:spark-common:compileTestJava :spark-connector:spark-3.5:compileJava -PscalaVersion=2.13 -PsparkVersionOverride=3.5.9 -PskipITs— passed, validating the common dependency boundary and Doris source exclusion../gradlew spotlessCheck rat— passed.git diff --check origin/main...HEAD— passed.Additional post-rebase checks performed before the latest review-hardening commit:
./gradlew :catalogs:catalog-jdbc-doris:test --tests org.apache.gravitino.catalog.doris.TestDorisCatalogPropertiesMetadata -PskipITs— passed; that Server-side code was unchanged by the latest commit.Real Doris evidence collected before the final rebase and the latest review-hardening commit:
SparkJdbcDorisCatalogIT3523 tests andSparkJdbcDorisLoadPrivilegeIT353 tests passed, with two environment-mode skips and no failures or errors.SparkJdbcDorisCatalogIT3523 tests andSparkJdbcDorisLoadPrivilegeIT353 tests passed, with two environment-mode skips and no failures or errors.SparkJdbcDorisAuthorizationIT35passed once on each combination with no failures, errors, or skips.SparkJdbcDorisCatalogIT35passed 23 tests against two active one-core workers with the external Gravitino, Doris, and MySQL JARs, with one deploy-only skip and no failures or errors.The final rebase integrated upstream changes in shared Spark test configuration and documentation without changing the Doris production behavior. The latest review-hardening commit only removes a version-specific test dependency from
spark-common, consolidates equivalent registration branches, and improves sanitized error diagnostics; it does not change the Doris read/write data plane, schema policy, authorization ordering, or forced connector options. The current-head checks above were rerun after that commit; the real Doris matrix was not rerun after the final rebase or the review-hardening commit.