Skip to content

Conversation

@kyo-tom
Copy link
Contributor

@kyo-tom kyo-tom commented Dec 20, 2025

Summary

Improves the RayS3DataLoadStrategy class to provide better format detection, more informative logging, and support for loading multiple files from S3 directories
in Ray mode.

Changes

1. Added format field support

  • Added "format" to optional_fields in CONFIG_VALIDATION_RULES
  • Users can now explicitly specify data format via the format config field
  • Critical for directory paths: When path points to an S3 directory, the format cannot be auto-detected from the path extension, so explicit format
    specification is now supported

2. Improved format detection logic

  • Changed from using "source" field to "format" field for better semantic clarity
  • format field now properly handles both file extensions (e.g., .json) and format names (e.g., json)
  • Auto-detection works for single file paths with extensions
  • For directory paths, users are guided to specify format explicitly

3. Enhanced logging

  • Auto-detection success: Now logs both the detected format and the file extension
    Auto-detected data format: json from extension: .jsonl
    
  • Auto-detection failure: Provides detailed warning with actionable suggestion
    Could not determine data format from path 's3://bucket/data/' (extension: '(none)'),
    defaulting to 'parquet'. Consider explicitly specifying 'format' field in dataset config.
    
  • Explicit format: Logs when format is specified by user
    Using specified data format: parquet
    

Benefits

  1. Directory support: Ray mode can now load multiple files from S3 directories by explicitly specifying the format
  2. Better user experience: Clear warnings help users understand why defaults are chosen
  3. Easier debugging: Detailed logs show exactly what format was detected and why
  4. More explicit config: Users can specify format directly instead of relying on path extensions
  5. Semantic clarity: Using format field name is more intuitive than source

Example Usage

Loading from S3 directory (New capability!)

# Load all JSON files from an S3 directory
dataset:
  path: s3://my-bucket/data/json-files/
  format: json  # Must specify format for directory paths
  aws_access_key_id: xxx
  aws_secret_access_key: xxx

# Load all Parquet files from an S3 directory
dataset:
  path: s3://my-bucket/data/parquet-files/
  format: parquet
  aws_access_key_id: xxx
  aws_secret_access_key: xxx

Loading single file with explicit format

dataset:
  path: s3://my-bucket/data/file.jsonl
  format: json  # Optional but recommended for clarity
  aws_access_key_id: xxx
  aws_secret_access_key: xxx

Auto-detection (works when path has extension)

dataset:
  path: s3://my-bucket/data/file.jsonl
  aws_access_key_id: xxx
  aws_secret_access_key: xxx
  # Will auto-detect as 'json' from .jsonl extension

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kyo-tom, 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 refines the RayS3DataLoadStrategy to offer a more robust and user-friendly experience for loading data from S3. The changes introduce explicit control over data format specification, improve the underlying detection mechanism, and provide clearer, more detailed logging to assist users in understanding and debugging data loading processes.

Highlights

  • Explicit Format Specification: Users can now explicitly specify the data format using a new 'format' field in the dataset configuration, which is now part of the validation rules for RayS3DataLoadStrategy.
  • Improved Format Detection: The data format detection logic has been enhanced to prioritize the new 'format' field over the previous 'source' field, and it correctly handles both file extensions (e.g., '.json') and format names (e.g., 'json').
  • Enhanced Logging: Logging has been significantly improved to provide more informative messages for auto-detection success (showing both detected format and extension), auto-detection failure (with actionable suggestions and defaulting to 'parquet'), and when a format is explicitly specified by the user.

🧠 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.

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 improves the RayS3DataLoadStrategy by introducing a format configuration option, enhancing the data format detection logic, and providing more informative logging. The changes make data loading from S3 more explicit and user-friendly.

My review focuses on improving the robustness of the new format detection logic. I've suggested a change to make the handling of the user-specified format more direct and less brittle for future extensions.

- Add 'format' field to optional config fields for explicit format specification
- Improve format validation: prioritize checking valid format names before extensions
- Replace 'source' field usage with 'format' for better semantic clarity
- Enhance auto-detection logging with file extension details
- Add informative warning when format cannot be determined from path
- Suggest users to explicitly specify 'format' field when auto-detection fails

The improved logic first checks if the provided format is a valid format name
(e.g., 'json', 'parquet'), making it more robust and easier to extend with
new formats that don't have a 1:1 mapping with file extensions.
@kyo-tom kyo-tom force-pushed the add-s3-dataset-format branch from d281bc9 to 9c813c5 Compare December 20, 2025 13:11
Copy link
Collaborator

@cyruszhang cyruszhang left a comment

Choose a reason for hiding this comment

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

LGTM

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