Skip to content

index_parquet_dataset() fails with TypeError when passing storage_options for S3 #835

Description

@alexansemyachkin

🐛 Bug: index_parquet_dataset() fails with TypeError when passing storage_options for S3

ld.index_parquet_dataset() fails with TypeError: filesystem() takes 1 positional argument but 4 were given when passing storage_options for S3. The bug is in litdata/utilities/parquet.py — it unpacks storage_options as positional arguments instead of keyword arguments.

To Reproduce

Steps to reproduce the behavior:

  1. Install litdata==0.2.61
  2. Call ld.index_parquet_dataset() with an S3 path and a storage_options dict
Code sample
import litdata as ld

pq_dataset_uri = 's3://bucket/path/to/parquet/'

ld.index_parquet_dataset(
    pq_dataset_uri,
    storage_options={
        "key": "ACCESS_KEY",
        "secret": "SECRET_KEY",
        "endpoint_url": "https://s3.example.com",
    },
)

Error:

TypeError: filesystem() takes 1 positional argument but 4 were given

Stack trace excerpt:

File ~/.local/lib/python3.11/site-packages/litdata/utilities/parquet.py:150, in filesystem()
    150 self.fs = fsspec.filesystem(provider, *self.storage_options)

Root Cause

The bug is in litdata/utilities/parquet.py line ~150:

# BUG: unpacks dict keys as positional args
self.fs = fsspec.filesystem(provider, *self.storage_options)

Should be:

# FIX: pass as keyword arguments
self.fs = fsspec.filesystem(provider, **self.storage_options)

Expected behavior

The function should pass storage_options as keyword arguments to fsspec.filesystem(), allowing S3 and other remote filesystems to be initialized correctly.

Additional context

This bug affects all users trying to use index_parquet_dataset() with S3 or any filesystem requiring authentication options.

Environment detail
  • litdata version: 0.2.61
  • Python version: 3.11
  • OS: Linux
  • Storage: S3-compatible (any provider)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions