Repository navigation
fix(widget): assign default row ids in row order - #276
Conversation
|
done, same row_number approach in both files. |
|
Oh, extra memory usage is an issue. Let's not do it in wasm for sure. How's memory usage with the native version? Does it spill to disk? |
…treamlit" This reverts commit 2e771db.
|
ok, reverted the wasm part, FileViewer and streamlit are back to nextval. |
Problem
When
row_idisn't given, the widget adds__row_index__withDEFAULT nextval('row_id_sequence'). DuckDB fills that default in parallel per row group (122,880 rows), so on larger data frames the ids stop following the row order. With 300k rows, 299,648 rows got a different id than their position.The
neighborscolumn fromcompute_projectionstores row positions (and the docstring says to use the zero-based row index), so in the widget the nearest neighbors point to the wrong points once the data frame has more than 122,880 rows.Fix
Number the rows in the
CREATE TABLE ... AS SELECTwithrow_number() OVER (), which keeps the original row order (duckdb docs). Like before, the column is only added when the data frame doesn't have it already. Added a test with 200k rows.