branch-4.1: [refactor](jdbc) Unify JDBC scanning into FileQueryScanNode/JniReader framework (#61141)#61733
Draft
morningman wants to merge 1 commit intoapache:branch-4.1from
Draft
branch-4.1: [refactor](jdbc) Unify JDBC scanning into FileQueryScanNode/JniReader framework (#61141)#61733morningman wants to merge 1 commit intoapache:branch-4.1from
morningman wants to merge 1 commit intoapache:branch-4.1from
Conversation
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
… framework (apache#61141) Refactor the JDBC data source scanning architecture to integrate with the unified FileScanner/JniReader framework, replacing the standalone ExternalScanNode-based JDBC scan path. The JDBC scan path was independently implemented with its own operator (JDBCScanLocalState), scanner (JdbcScanner), and JNI connector (JniConnector → BaseJdbcExecutor hierarchy), while other JNI-based data sources (Paimon, Hudi, MaxCompute, TrinoConnector) already use the unified FileScanner → JniReader → JniScanner path. This caused code duplication, maintenance burden, and architectural inconsistency. 1. BE: Split JniConnector into two focused classes: - JniReader: JNI lifecycle management (open/read/close), base class for all JNI readers (PaimonJniReader, HudiJniReader, JdbcJniReader, etc.) - JniDataBridge: Stateless data exchange between C++ Blocks and Java shared memory via JNI 2. Java: Introduce Strategy Pattern for database-specific type handling: - JdbcTypeHandler interface with DefaultTypeHandler base implementation - Per-database handlers: MySQLTypeHandler, OracleTypeHandler, PostgreSQLTypeHandler, ClickHouseTypeHandler, SQLServerTypeHandler, DB2TypeHandler, SapHanaTypeHandler, TrinoTypeHandler, GbaseTypeHandler - JdbcTypeHandlerFactory for handler selection - JdbcJniScanner (extends JniScanner) for read path - JdbcJniWriter (extends JniWriter) for write path - Old BaseJdbcExecutor subclasses marked @deprecated but preserved 3. FE: Migrate JdbcScanNode from ExternalScanNode to FileQueryScanNode: - JdbcScanNode now extends FileQueryScanNode - Introduces JdbcSplit (extends FileSplit) to carry JDBC params - Uses TFileScanRange with FORMAT_JNI and table_format_type="jdbc" - Adds jdbc_params field to TTableFormatFileDesc in Thrift - Adapts PhysicalPlanTranslator.visitPhysicalJdbcScan() accordingly 4. BE: Add JdbcJniReader and integrate into FileScanner: - JdbcJniReader handles special types (bitmap, HLL, quantile_state, JSONB) via string-based intermediary and CAST - FileScanner._get_next_reader() adds "jdbc" table_format_type branch - JdbcUtils utility for JDBC driver URL resolution - Existing JdbcScanner preserved as transitional (deprecated) All predicate push-down logic (createJdbcFilters, getJdbcQueryStr, etc.) is preserved from the original JdbcScanNode implementation.
Contributor
Author
|
run buildall |
Contributor
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
FE UT Coverage ReportIncrement line coverage |
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.
bp #61141