Skip to content

WSS3Shard/WSModalShard: fix reading string columns (incl. __key__) - #89

Draft
jpc wants to merge 1 commit into
mainfrom
jpc/s3-shard-string-columns
Draft

jpc wants to merge 1 commit into
mainfrom
jpc/s3-shard-string-columns

Conversation

@jpc

@jpc jpc commented Sep 18, 2026

Copy link
Copy Markdown
Member

Problem

On main, reading any string column through an S3 (or Modal) shard fails:

ValueError: Failed to decode column __key__ in shard s3://…/shard_…_audio.wsds (offset 5):
'str' object has no attribute '_optimal_read_size'

pupyarrow exposes string columns as LazyBinaryArrays too, but their elements are plain strs, so the isinstance(col, LazyBinaryArray) guard lets them through and data._optimal_read_size = … blows up. Affects __key__, audio_type, … — everything except the binary blob itself.

Fix

Check the value (isinstance(data, LazyBuffer)), not the column. Same two lines in WSS3Shard and WSModalShard.

Testing

Against a real B2 shard: get_sample('__key__'), get_sample('audio_type'), and get_sample('audio').read_segment(1, 2) all work. Existing test-suite result unchanged (the 6 doctest failures that need local datasets are pre-existing on main).

Needed by #90 for linking audio_type alongside audio; independent otherwise.

🤖 Generated with Claude Code

pupyarrow hands out string columns as LazyBinaryArrays as well, but their
elements are plain `str`s, so `data._optimal_read_size = ...` raised

    ValueError: Failed to decode column __key__ ...: 'str' object has no
    attribute '_optimal_read_size'

for every non-binary column of an S3/Modal shard (`__key__`, `audio_type`).
Check the value, not the column.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant