Skip to content

fix(tables): preserve columns in DefaultTableManager exports#9258

Merged
kirangadhave merged 1 commit into
mainfrom
kg/csv-columns-bug
Apr 20, 2026
Merged

fix(tables): preserve columns in DefaultTableManager exports#9258
kirangadhave merged 1 commit into
mainfrom
kg/csv-columns-bug

Conversation

@kirangadhave

Copy link
Copy Markdown
Member

📝 Summary

Closes https://github.com/marimo-team/qa-agent/issues/12

  • get_column_names() now unions keys across first 1000 rows. previously we checked only first row
  • _normalize_data() pads short columns with None with zip_longest. Prevents row omission in column-oriented data
  • select_columns() on row-oriented data uses row.get(key) instead of row[key]. Missing keys become None rather than raising KeyError.
  • get_num_rows() for column-oriented data returns the longest column length, matching normalized output.
@kirangadhave kirangadhave added the bug Something isn't working label Apr 18, 2026
@kirangadhave kirangadhave requested a review from mscolnick April 18, 2026 00:22
@vercel

vercel Bot commented Apr 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Apr 20, 2026 9:09pm

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves DefaultTableManager export/selection behavior so heterogeneous row-oriented data and mismatched-length column-oriented data preserve all columns/rows consistently (instead of silently omitting them).

Changes:

  • Infer row-oriented column names by unioning keys across the first 1000 rows (first-seen order).
  • Normalize column-oriented dict-of-lists using zip_longest(..., fillvalue=None) and compute row count as the longest column.
  • Make row-oriented select_columns() resilient to missing keys by using row.get(...) (fills with None).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
marimo/_plugins/ui/_impl/tables/default_table.py Updates column inference, normalization, selection behavior, and row counting to preserve columns/rows in exports.
tests/_plugins/ui/_impl/tables/test_default_table.py Adds coverage for heterogeneous row keys and mismatched column lengths in CSV/JSON and helpers.
Comment thread marimo/_plugins/ui/_impl/tables/default_table.py
@kirangadhave kirangadhave merged commit 0381288 into main Apr 20, 2026
28 of 43 checks passed
@kirangadhave kirangadhave deleted the kg/csv-columns-bug branch April 20, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

3 participants