{"slug": "one-more-measured-note-for-datasets-the-polars-format-raises-on-any-decodable", "title": "One more measured note for datasets — the polars format raises on any decodable feature", "summary": "A bug report reproduced a `TypeError: 'dict' object is not callable` on Hugging Face Datasets 5.2.0 with PyArrow 24.0.0 and Polars 1.35.2, where normal decoded-image row and batch reads failed on both `Dataset` and `IterableDataset` while consuming the eager image column worked. The reporter found the complementary fixes in pull requests #8402 (select the actual columns to decode) and #9156 (choose an output type), with #8403 addressing a separate pandas projection issue, and warned that successful PIL-image reads do not imply safe Arrow writeback — returning a decoded DataFrame from a batched map produced eight-byte binary values in place of the original image storage.", "body_md": "I was able to reproduce it too, so I tried a few variations:\n\nI reproduced the same `TypeError: 'dict' object is not callable` on Datasets 5.2.0, PyArrow 24.0.0 and Polars 1.35.2. The normal decoded-image row and batch reads failed on both `Dataset` and `IterableDataset`; consuming the eager image column worked. Plain text, Python, full pandas and raw-image controls succeeded.\n\nThe fixes [#8402](https://github.com/huggingface/datasets/pull/8402) and [#9156](https://github.com/huggingface/datasets/pull/9156) are complementary: select the actual columns to decode, then choose an output type. Both combined shapes covered the selected Polars read cases. [#8403](https://github.com/huggingface/datasets/pull/8403) fixes a separate pandas projection issue.\n\nOne more distinction matters for users of the integration: successful PIL-image reads do not imply safe Arrow writeback. Returning a decoded DataFrame from a batched map produced eight-byte binary values in place of the original image storage; returning just a dictionary of the new columns also lost the existing columns in the table-format cases I tried.\n\n| Goal | Route | \n|---|---|\n| Work only on ordinary columns | Actual `select_columns` , not just the format’s`columns=` . | \n| Add a column without changing images | Python-format map, or a separate Polars calculation followed by checked `add_column` . | \n| Read PIL images | Python format, or a checked decoded formatter. | \n| Process encoded storage | Raw export or `Image(decode=False)` ; preserve Features when reconstructing. | \n| Modify images in a returned table | Explicit image encoding and compatible output Features. | \n\nThe first two routes worked on the unmodified release. When images need not change, keep their storage rather than decode and re-encode just to calculate another column.\n\n1. Independent reproduction and the read paths", "url": "https://wpnews.pro/news/one-more-measured-note-for-datasets-the-polars-format-raises-on-any-decodable", "canonical_source": "https://discuss.huggingface.co/t/one-more-measured-note-for-datasets-the-polars-format-raises-on-any-decodable-feature/192462#post_2", "published_at": "2026-11-27 05:10:19+00:00", "updated_at": "2026-11-27 05:12:37.033537+00:00", "lang": "en", "topics": ["machine-learning", "developer-tools"], "entities": ["Hugging Face", "Datasets", "Polars", "PyArrow", "Dataset", "IterableDataset"], "also_reported_by": [], "takeaway": "On Datasets 5.2.0 with Polars, select the actual columns to decode (PR #8402) and set an output type (PR #9156) rather than relying on the format's `columns=`, and avoid returning decoded DataFrames from batched maps because they write eight-byte binary values over the original image storage.", "recommendation": {"advice": "When reading image datasets with Polars, use explicit `select_columns` plus a chosen output type, and keep images in encoded storage unless they must change, since decoded DataFrame writeback corrupts image columns.", "playbook": "training-data", "playbook_url": "https://wpnews.pro/playbooks/training-data"}, "alternates": {"html": "https://wpnews.pro/news/one-more-measured-note-for-datasets-the-polars-format-raises-on-any-decodable", "markdown": "https://wpnews.pro/news/one-more-measured-note-for-datasets-the-polars-format-raises-on-any-decodable.md", "text": "https://wpnews.pro/news/one-more-measured-note-for-datasets-the-polars-format-raises-on-any-decodable.txt", "jsonld": "https://wpnews.pro/news/one-more-measured-note-for-datasets-the-polars-format-raises-on-any-decodable.jsonld"}}