feat(dataview): read data rows truely on demand - #1717
Conversation
- 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
…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
Improvments based on official vscode-R's PR REditorSupport#1708 and REditorSupport#1717
- 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
|
Just made a few more small enhancements.
scrollbar.movI 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 |
|
Just identified some issues when I built and used this under the new vscode-R architecture. Data with many columns and with free texts may encounter failure to fetch data, although it has no issue if data is loaded via |
|
The issue should be fixed. Previously, large JSON-RPC responses were converted from R character strings to raw bytes inside processx::conn_write(), which delayed transmission. And the extension repeatedly concatenated and rescanned the accumulated response whenever a new socket chunk arrived. The fix converts JSON to UTF-8 raw bytes before writing, and buffers incoming socket data as bytes, decoding each complete message only once. With my own data, the data viewer now opens instantly for a data containing 5M rows and 150 columns with free text and grouping text fields. |
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
Data Viewer Changes
(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