Skip to content

feat(dataview): read data rows truely on demand#1717

Open
Fred-Wu wants to merge 3 commits into
REditorSupport:masterfrom
Fred-Wu:feat/lazy-dataview-loading
Open

feat(dataview): read data rows truely on demand#1717
Fred-Wu wants to merge 3 commits into
REditorSupport:masterfrom
Fred-Wu:feat/lazy-dataview-loading

Conversation

@Fred-Wu

@Fred-Wu Fred-Wu commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR attempts to introduce a true on demand data loading from R.

The RC already introduced a dynamic data viewer, but R still prepared data for all columns when the viewer opened. This included creating the full row index, splitting matrix columns, and converting an entire Arrow object data to data frame. Values were also formatted as text.

What changes

On-demand loading

  • Keep the original R data without preparing all columns.
  • Read only column information initially.
  • Read and convert only the requested rows during scrolling.
  • Support R data frames, matrices, Arrow data and Polars DataFrames.
  • Preserve numeric, logical, date and text values instead of formatting everything as text.
  • Sorting and filtering now remember the matching row order, so scrolling does not repeat the same work.

Data Viewer Changes

  • Disables sorting and filtering for:
    • Complex number columns
    • List columns
    • Raw columns
    • The row-number column
  • Sorts ordered factors according to their declared R level order.
  • Show (filtered/original) in the row-number heading when filtering is active.

If this is accepted, and works well, probably could remove those 2 pagination settings as well. Here is an example to open 10M records with 100 columns.

Current data loading

demo_original.mov

New data loading

demo_new.mov

Fred-Wu added 2 commits July 1, 2026 01:53
- Keep the original R data source and slice only requested rows instead of
preparing complete columns when the viewer opens.

- Avoid full Arrow conversion, support Polars DataFrames, preserve R value types,
and reuse sorting and filtering results when the viewer requests more rows.
…ta types

- use dateString and dateTimeString for R Date and POSIX values
- use bigint for R integer64 values
- make bit64 an optional package dependency
Fred-Wu added a commit to Fred-Wu/vscode-R that referenced this pull request Jul 6, 2026
…ession architecture

- upgrade AG Grid Community to v35.2.1 and adopt v35 APIs
- improve typed sorting, filtering, bigint and logical NA handling
- support native Arrow and Polars data frames
- remove the data.table dependency
- add fetch status and scrollbar row-position feedback
Fred-Wu added a commit to Fred-Wu/vscode-R that referenced this pull request Jul 6, 2026
- new - show current row out of total while dragging the scrollbar
- new - also calculate scroll position under the current pagination setting
- new - format filtered/total counts in the row-index header
- fix - display unloaded rows with empty background
- fix - render R's NA values across column types, and style it with lighter italic text
@Fred-Wu

Fred-Wu commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Just made a few more small enhancements.

  1. A NA value is now displayed as image

  2. Added row position indicator to show current row out of total when clicking on or dragging scrollbar. This also applies to paginated data viewer.

scrollbar.mov

I would suggest to remove the pagination setting. The lazying data loading sets the batch number at 500. Opening and scrolling are fast. However, one may set page size to, e.g. 10,000, this actually slows things down as cacheBlockSize equals to page size. Transferring data from R to data viewer would then be slower.

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