[Data] Add path_column support to ParquetDatasource - #63758
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a path_column parameter to read_parquet and the underlying datasources, allowing users to specify a custom column name for file paths when include_paths is enabled. This prevents conflicts with existing columns in the dataset. The review feedback suggests normalizing self._path_column to its default value ('path') during initialization in ParquetDatasource._init_state, which would simplify subsequent references by removing redundant fallback checks.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit bd22664ec707d6bc9447dd865513939b72e75926. Configure here.
Add a public path_column option to read_parquet when include_paths is enabled so callers can avoid clobbering an existing path field. Thread the option through the V1 and V2 parquet readers and add coverage for schema inference and end-to-end reads with a custom path column name. Signed-off-by: daiping8 <dai.ping88@zte.com.cn>
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
keep |
|
OK just coming back to this PR. Feels like we should just introduce a string typing to
|

Motivation
This change addresses a limitation in Ray's Parquet reading functionality where the file path column name is hardcoded to "path". This causes data loss when reading files that already contain a "path" column, as the original column values are overwritten with file paths.
The fix enables users to:
Related Issue
Closed #63757
Implementation Details
Core API Changes
python/ray/data/read_api.pypath_columnparameter toread_parquet()function signaturepython/ray/data/datasource/file_based_datasource.pypath_columnparameter to__init__fill_columncall to use custom nameKey Design Decisions
Default behavior preserved: When
path_column=None, defaults to "path" for full backward compatibilityConsistent across versions: Both V1 and V2 datasources support the feature identically
Schema inference aware: The custom column name is respected during schema inference, preventing duplicate columns
Minimal API surface: Only exposes
path_columnat theread_parquet()API level; internal threading is transparentVerification
Unit Tests
V1 datasource test:
V2 datasource test:
Manual Verification
Test conflict avoidance:
Test backward compatibility:
Test schema inference:
Integration Testing
Run the full parquet datasource test suite: