[refactor] Refactored into multiple modules to be compatible with different spark version features #239
+8,975
−1,053
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.
Proposed changes
Issue Number: close #xxx
Problem Summary:
In the past, all codes were in the same module. In order to be compatible with different Spark versions, many features available in higher versions were abandoned, which brought inconvenience to use.
So refactoring is imperative.
After reconstruction, it is divided into the following modules:
spark-doris-connector-base
This module contains the basic implementation of interaction with Doris, such as reading, writing and other API access.
In this module, there are several important abstractions, DorisReader, DorisWriter and DorisCommitter
This interface provides hashNext and next methods to determine whether the reading is finished and to obtain the next piece of data. Currently, two reading methods based on Thrift and Arrow Flight SQL are implemented.
This interface mainly provides the load and stop methods for writing a piece of data and stopping an import task.
This interface mainly provides commit and abort methods for committing and rolling back transactions.
Considering the consistency of writing and transaction processing, the write processor based on stream load or copy into implements both DorisWriter and DorisCommitter in the same class.
spark-doris-connector-dist
This module is used to package.
spark-doris-connector-it
This module is for end-to-end testing.
spark-doris-connector-shims
This module is a shim layer used to implement functions of different spark versions.
Currently, the version split is only based on spark 3.
For the future higher spark 4 version, you can also add modules here to implement the function of minor version differences.
This module is implemented based on spark 2.
This module is implemented based on spark 3. It relies on different shim layers for different minor versions, which provides better compatibility.
In addition, a new feature has been added: converting and reading Bitmap type data through Arrow Flight SQL
Example
Result
Convert a bitmap into a comma-delimited string containing all the set BIT bits. If the input is null, null will be returned.
Checklist(Required)
Further comments
If this is a relatively large or complex change, kick off the discussion at [email protected] by explaining why you chose the solution you did and what alternatives you considered, etc...