Skip to content

Add support for json[l].gz, and make ray dataset support reading json…#919

Open
HunterLine wants to merge 1 commit intodatajuicer:mainfrom
HunterLine:feature/add_json_zst_gz
Open

Add support for json[l].gz, and make ray dataset support reading json…#919
HunterLine wants to merge 1 commit intodatajuicer:mainfrom
HunterLine:feature/add_json_zst_gz

Conversation

@HunterLine
Copy link
Contributor

  1. Add support for json[l].gz
  2. Make ray dataset support reading json[l].gz json[l].zst format

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @HunterLine, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the data loading capabilities by extending support for compressed JSON and JSONL formats, specifically .gz and .zst files. It integrates these new formats into the Ray dataset reading pipeline and ensures that the system's file utilities and formatters can correctly recognize and handle them. This change improves flexibility when working with various compressed data sources.

Highlights

  • Expanded File Format Support: Added support for reading json.gz and jsonl.gz compressed JSON files across the system.
  • Ray Dataset Integration: Enabled Ray datasets to natively support reading json.gz, jsonl.gz, json.zst, and jsonl.zst formats.
  • Suffix Recognition: Updated file utility functions and JSON formatter to correctly identify and process files with .gz and .zst suffixes for JSON and JSONL formats.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • data_juicer/core/data/load_strategy.py
    • Extended the list of recognized data formats to include 'json.gz', 'jsonl.gz', 'json.zst', and 'jsonl.zst' when determining whether to use read_json_stream.
  • data_juicer/core/data/ray_dataset.py
    • Updated the read class method to recognize 'json.gz', 'jsonl.gz', 'json.zst', and 'jsonl.zst' as JSON-like formats.
    • Expanded the default file_extensions list in read_json_stream to include 'json.gz', 'jsonl.gz', 'json.zst', and 'jsonl.zst' for proper file identification.
  • data_juicer/format/json_formatter.py
    • Modified the SUFFIXES class variable to include 'json.gz', 'jsonl.gz', 'json.zst', and 'jsonl.zst' as valid JSON-related file suffixes.
  • data_juicer/utils/file_utils.py
    • Imported GzipExtractor to handle gzip-compressed files.
    • Added logic within find_files_with_suffix to correctly identify and extract suffixes for gzip-compressed files (e.g., '.jsonl.gz').
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for reading gzipped and zstd compressed JSON and JSONL files, including for Ray Datasets. The changes look good and extend the data loading capabilities. I've added a few comments with suggestions to improve code consistency and maintainability, such as standardizing string quotes and suffix formats, and a suggestion to refactor some duplicated code.

@cyruszhang
Copy link
Collaborator

  1. please resolve pre-commit errors
  2. can we add some test case?

@cyruszhang cyruszhang self-requested a review February 25, 2026 18:28
@HunterLine
Copy link
Contributor Author

Yes, I have resolved the pre-commit errors and added some test cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants