-
Notifications
You must be signed in to change notification settings - Fork 316
feat: Support iceberg、hudi、delta、hdfs data source. #875
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
Open
Dludora
wants to merge
20
commits into
datajuicer:main
Choose a base branch
from
Dludora:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b54eb3a
feat: support hdfs and iceberg
Dludora 06f034a
feat: add load data from hdfs source
c4c7f0b
feat: demo for hdfs load
37db9bf
feat: read iceberg file
Dludora 1368eaf
feat: iceberg read
Dludora f4856b6
feat: process iceberg and hdfs
Dludora 9f8a551
refractor: secret
Dludora 2b3b620
feat: export iceberg and others
4a24682
feat: write iceberg
Dludora ebd23d2
refractor: move fs
Dludora 12a4524
refractor: move fs
Dludora 2744914
feat: delta and hudi
Dludora 79b3e04
refractor: restore file_utils
Dludora cc7b07b
refractor: add Any type
Dludora b4c698c
feat: fallback ray_expoeter
Dludora 9d78a7a
Merge remote-tracking branch 'upstream/main'
Dludora 087941c
fix: pyproject
Dludora 9d18059
style: code style check
Dludora 2b00595
restore: ray_executor s3
Dludora 972f9ff
Merge branch 'datajuicer:main' into main
Dludora File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| """ | ||
|
|
||
| import os | ||
| from typing import Dict, Tuple | ||
| from typing import Any, Dict, Tuple | ||
|
|
||
| import pyarrow.fs | ||
| from loguru import logger | ||
|
|
@@ -117,3 +117,30 @@ def validate_s3_path(path: str) -> None: | |
| """ | ||
| if not path.startswith("s3://"): | ||
| raise ValueError(f"S3 path must start with 's3://', got: {path}") | ||
|
|
||
|
|
||
| def create_filesystem_from_args(path: str, args: Dict[str, Any]): | ||
| """ | ||
| Create a PyArrow FileSystem based on the path prefix and parameters. | ||
| Automatically extract relevant credentials from args and remove them from args (using pop) to avoid polluting subsequent parameters. | ||
| """ | ||
| fs = None | ||
| if path.startswith("s3://"): | ||
| validate_s3_path(path) | ||
|
|
||
| s3_keys = ["aws_access_key_id", "aws_secret_access_key", "aws_session_token", "aws_region", "endpoint_url"] | ||
| s3_conf = {k: args.pop(k) for k in s3_keys if k in args} | ||
| fs = create_pyarrow_s3_filesystem(s3_conf) | ||
| logger.info(f"Detected S3 export path: {path}. S3 filesystem configured.") | ||
|
|
||
| elif path.startswith("hdfs://"): | ||
| import pyarrow.fs as pa_fs | ||
|
|
||
| hdfs_keys = ["host", "port", "user", "kerb_ticket", "extra_conf"] | ||
| hdfs_conf = {k: args.pop(k) for k in hdfs_keys if k in args} | ||
| if "port" in hdfs_conf: | ||
| hdfs_conf["port"] = int(hdfs_conf["port"]) | ||
| fs = pa_fs.HadoopFileSystem(**hdfs_conf) | ||
| logger.info(f"Detected HDFS export path: {path}. HDFS filesystem configured.") | ||
|
Comment on lines
+128
to
+144
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add an extra else branch to raise a warning or error for unsupported prefix. |
||
|
|
||
| return fs | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # Process config example for dataset | ||
|
|
||
| # global parameters | ||
| project_name: 'demo' | ||
|
|
||
|
|
||
| np: 1 # number of subprocess to process your dataset | ||
|
|
||
| export_path: './outputs/demo/demo-processed-ray' | ||
|
|
||
| dataset: | ||
| configs: | ||
| - type: remote | ||
| source: hdfs | ||
| path: hdfs://your_hdfs_path/demo-dataset.jsonl | ||
| host: your_hdfs_host | ||
| port: 8020 | ||
| user: your_username | ||
|
|
||
| # process schedule | ||
| # a list of several process operators with their arguments | ||
| process: | ||
| # Filter ops | ||
| - alphanumeric_filter: # filter text with alphabet/numeric ratio out of specific range. | ||
| tokenization: false # Whether to count the ratio of alphanumeric to the total number of tokens. | ||
| min_ratio: 0.0 # the min ratio of filter range | ||
| max_ratio: 0.9 # the max ratio of filter range | ||
| - average_line_length_filter: # filter text with the average length of lines out of specific range. | ||
| min_len: 10 # the min length of filter range | ||
| max_len: 10000 # the max length of filter range | ||
| - character_repetition_filter: # filter text with the character repetition ratio out of specific range | ||
| rep_len: 10 # repetition length for char-level n-gram | ||
| min_ratio: 0.0 # the min ratio of filter range | ||
| max_ratio: 0.5 # the max ratio of filter range | ||
| - flagged_words_filter: # filter text with the flagged-word ratio larger than a specific max value | ||
| lang: en # consider flagged words in what language | ||
| tokenization: false # whether to use model to tokenize documents | ||
| max_ratio: 0.0045 # the max ratio to filter text | ||
| flagged_words_dir: ./assets # directory to store flagged words dictionaries | ||
| use_words_aug: false # whether to augment words, especially for Chinese and Vietnamese | ||
| words_aug_group_sizes: [2] # the group size of words to augment | ||
| words_aug_join_char: "" # the join char between words to augment | ||
| - language_id_score_filter: # filter text in specific language with language scores larger than a specific max value | ||
| lang: en # keep text in what language | ||
| min_score: 0.8 # the min language scores to filter text | ||
| - maximum_line_length_filter: # filter text with the maximum length of lines out of specific range | ||
| min_len: 10 # the min length of filter range | ||
| max_len: 10000 # the max length of filter range | ||
| - perplexity_filter: # filter text with perplexity score out of specific range | ||
| lang: en # compute perplexity in what language | ||
| max_ppl: 1500 # the max perplexity score to filter text | ||
| - special_characters_filter: # filter text with special-char ratio out of specific range | ||
| min_ratio: 0.0 # the min ratio of filter range | ||
| max_ratio: 0.25 # the max ratio of filter range | ||
| - stopwords_filter: # filter text with stopword ratio smaller than a specific min value | ||
| lang: en # consider stopwords in what language | ||
| tokenization: false # whether to use model to tokenize documents | ||
| min_ratio: 0.3 # the min ratio to filter text | ||
| stopwords_dir: ./assets # directory to store stopwords dictionaries | ||
| use_words_aug: false # whether to augment words, especially for Chinese and Vietnamese | ||
| words_aug_group_sizes: [2] # the group size of words to augment | ||
| words_aug_join_char: "" # the join char between words to augment | ||
| - text_length_filter: # filter text with length out of specific range | ||
| min_len: 10 # the min length of filter range | ||
| max_len: 10000 # the max length of filter range | ||
| - words_num_filter: # filter text with number of words out of specific range | ||
| lang: en # sample in which language | ||
| tokenization: false # whether to use model to tokenize documents | ||
| min_num: 10 # the min number of filter range | ||
| max_num: 10000 # the max number of filter range | ||
| - word_repetition_filter: # filter text with the word repetition ratio out of specific range | ||
| lang: en # sample in which language | ||
| tokenization: false # whether to use model to tokenize documents | ||
| rep_len: 10 # repetition length for word-level n-gram | ||
| min_ratio: 0.0 # the min ratio of filter range | ||
| max_ratio: 0.5 # the max ratio of filter range |
Oops, something went wrong.
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.
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.
Checking if the returned fs is None might be necessary.