-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[Feature][connector-file-local]localfile supports splitting and parallel reading of large files of csv, text, and json #10142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
[Feature][connector-file-local]localfile supports splitting and parallel reading of large files of csv, text, and json #10142
Conversation
...ase/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/config/FileBaseOptions.java
Outdated
Show resolved
Hide resolved
|
LGTM |
corgy-w
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, you should update the documentation.
After enabling enable_split_file, the original skip_header behavior for the file no longer works as before. Is there any way to keep it compatible?
|
.../java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/AbstractReadStrategy.java
Show resolved
Hide resolved
...ase/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/config/FileBaseOptions.java
Outdated
Show resolved
Hide resolved
...ase/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/config/FileBaseOptions.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/seatunnel/connectors/seatunnel/file/local/source/LocalFileSource.java
Outdated
Show resolved
Hide resolved
| URL url = getClass().getClassLoader().getResource("test_split_csv_data.csv"); | ||
| String realPath = Paths.get(url.toURI()).toString(); | ||
| final List<FileSourceSplit> splits = localFileSplitStrategy.split("test.table", realPath); | ||
| Assertions.assertEquals(4, splits.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add line count check
| URL url = getClass().getClassLoader().getResource("test_split_csv_data.csv"); | ||
| String realPath = Paths.get(url.toURI()).toString(); | ||
| final List<FileSourceSplit> splits = localFileSplitStrategy.split("test.table", realPath); | ||
| Assertions.assertEquals(2, splits.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add line count check
| import java.nio.file.Paths; | ||
| import java.util.List; | ||
|
|
||
| public class SplitFileStrategyTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add escape characters to test: when the field content contains a newline character, the line is not truncated.
e.g(csv):
1,t1,"a
b"
2,t2,"c
d"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add escape characters to test: when the field content contains a newline character, the line is not truncated.
e.g(csv):
1,t1,"a b" 2,t2,"c d"
please see: #10185
corgy-w
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your change not only involves localfile, but also other files related documents need to be changed.
Connectors of different file types have different logic. Currently, only local implements AccordingToSplitSizeSplitStrategy, so only the localfile document is modified. |
Issue
#10129
Check list