Changelog¶
All notable changes to this project are recorded here. The format follows Keep a Changelog, and versions follow Semantic Versioning.
The distribution is ursa-graph; the import name is ursa.
Unreleased¶
Added¶
- Ursa SQL 0.6: a SQL engine for graph analytics, and the
ursacommand-line tool (crateursa-cli, released as 0.6.0 on 2026-11-06; the engine crates areursa-engineandursa-sql). This is its first release. It is versioned apart from the Python package. Changes onmainsince then are released asursa-cli0.7.0 (2026-11-06), 0.8.0 (2026-11-07), 0.9.0 (2026-11-10), 0.10.0 (2026-11-17), 0.11.0 (2026-11-18), 0.12.0 (2026-11-24) and 0.13.0 (2026-11-25). - Any Parquet or CSV file is a table:
SELECT * FROM 'edges.parquet', with globs, directories, compressed CSV, ands3://,gs://,az://andhttps://URLs. Built on DataFusion 55.2. DuckDB's FROM-first queries work:FROM t [WHERE …]isSELECT * FROM t …(#306). - Graphs are defined with SQL/PGQ
CREATE PROPERTY GRAPH: any number of vertex and edge tables,ASnames,LABEL,PROPERTIES, and a vertexKEYthat may be left out (the primary key, or the column the edgesREFERENCES, as DuckPGQ infers it), so DuckPGQ graph definitions run as written (#295), DuckPGQ'sPROPERTIES (…) LABEL xorder included (#307). Ursa adds optional vertex tables. A graph of one edge table is a schema:g.edgesandg.nodes. An algorithm runs on one vertex table and one edge table, named as DuckPGQ names them when a graph has several:pagerank(g, person, knows).DROP PROPERTY GRAPH,SHOW GRAPHSandDESCRIBE [PROPERTY] GRAPHmanage them. - SQL/PGQ pattern matching:
GRAPH_TABLE (g MATCH (a)-[e]->(b) WHERE … COLUMNS (…))with labels, every edge direction, element and pattern conditions, and several paths sharing variables, planned as joins (#296). Quantified edges (-[e]->{1,3},->*,+,?), path variables,ANY SHORTEST,ALL SHORTEST,SHORTEST k, the path modesTRAIL,SIMPLEandACYCLIC, andpath_length(p),vertices(p),edges(p)andelement_id(p), searched breadth-first on the graph index rather than joined; among equally short paths, the one whose edges come first in the edge table (#297). - Every algorithm and statistic of the Python library (not the layouts or
the neighbour aggregations) is a table function with named parameters
(
pagerank(g, damping => 0.9)), with the same names, defaults and values.algorithms(g, …)runs several over one index in one call.hop,random_walkandshortest_pathare traversals, with seeds from a list or a subquery.weight =>takes any expression over the edge columns. SELECT * FROM ursa_functions()lists every graph function with its parameters, defaults, accepted values, outputs and NetworkX equivalent.- A
.ursadatabase file keeps views, external tables and graphs, and stores the graph indexes it builds, so a later process does not rebuild them. A changed source file is noticed and its index rebuilt.ATTACH,--readonly, andSET/SHOW ursa.index_storage_limit. - An interactive shell with DuckDB-style dot-commands,
-initfiles,~/.ursarcand history; output as table, CSV, TSV, JSON, NDJSON or Arrow (--format);-c,-f/--fileand stdin run SQL and exit, as in DuckDB;ursa --version. - Docs: a new SQL section on the docs site, with a function reference
generated from
ursa_functions(). Every SQL example in it runs in CI. - An agent skill for writing Ursa SQL, in
skills/ursa-sql/. - Prebuilt binaries for Linux (x86_64, aarch64), macOS (x86_64, Apple
silicon) and Windows (x64) on the GitHub Releases page, and a one-line
installer for them that checks each download's SHA-256 checksum:
curl -fsSL https://cldixon.github.io/ursa/install.sh | sh, orirm https://cldixon.github.io/ursa/install.ps1 | iexon Windows. - Ursa SQL: DuckDB familiarity (#313).
.jsonland.ndjsonfiles, and compressed ones (.jsonl.gz,.ndjson.zst,.bz2,.xz), are read as newline-delimited JSON, as.jsonis, by path, glob, directory or URL.COPY … TO 'out.jsonl'writes them.read_parquet(path),read_csv(path, header =>, delim =>, quote =>, compression =>)andread_json(path, compression =>, format => 'array')read a file in the format they name, whatever its extension. The path may be a glob, a directory, a URL or a list of paths; options are named with=>or DuckDB's=.read_csv_auto,read_json_autoandread_ndjsonare other names. A view over one, in a database, keeps its paths relative to the database file.SHOW TABLESleaves outinformation_schema's own views.- Docs: a "Differences from DuckDB" page, the file formats and
read_*functions in the statements page, andCOPY's row count. - Ursa SQL: more DuckDB and DuckPGQ habits (#417). Each of these failed with a parser error or a message that did not name the fix.
COPY … TO 'f' (FORMAT parquet, HEADER, DELIMITER '|', COMPRESSION zstd), andWITH (…): DuckDB's option list maps ontoSTORED ASandOPTIONS.DELIMandSEPareDELIMITER's other names; any other option is refused by name.SET threads = nsetsdatafusion.execution.target_partitions.SETof another name without anursa.ordatafusion.prefix says that Ursa's settings start with one, and thatSHOW ALLlists them.DROP GRAPH gandSHOW PROPERTY GRAPHS. DuckPGQ'sSUMMARIZE PROPERTY GRAPH greturnsdescribe(g)for a graph of one edge table and says to name the pair for more.ALTER PROPERTY GRAPHsays to useCREATE OR REPLACE PROPERTY GRAPH.ORDER BY ALLorders by every column of theSELECTlist; afterSELECT *, the error says to name the columns or their positions.SHOW 'file.csv'isDESCRIBE 'file.csv'.CREATE TEMP TABLEandCREATE TEMP VIEWrun; a database file does not store them.- Hints:
SELECT pagerank(g), for every graph function, says it is a table function (SELECT * FROM pagerank(g));SELECT id, pagerank FROM g.nodessays to join the function's rows onid(#300); an unquoted file name,FROM karate_edges.csv, says to quote the path. - DuckDB's names for DataFusion's functions:
list_value(make_array),strftime(to_char, either argument order),epoch_ms(milliseconds to a timestamp and back), and the aggregatesarg_maxandarg_min(first_value … ORDER BY, skipping NULLs). - Tests:
DESCRIBE FROM,EXPLAIN FROM,CREATE VIEW v AS FROMandCOPY (FROM t) TOtogether, on DuckPGQ's graph. ursafor agents and scripts (#312):-ffiles,-cand SQL on stdin take dot-commands, as-initfiles and.readdo, and as in DuckDB:.timer on,.mode csv,.read. In a script,.quitand.exitend the run with status 0, and an unknown dot-command is an error. With--format arrow, a dot-command's text (the timer's, say) goes to stderr, so stdout stays one Arrow stream.ursa --skillprints the agent skill (skills/ursa-sql/SKILL.md), built into the binary.--helpends with examples, aCREATE PROPERTY GRAPHline,ursa_functions(),--format json,--skilland the docs URL; the shell's.helpand the installers point to the docs too..functions NAMEshows one function's summary, its parameters one a line (type, default, what it does, the values it takes) and its output columns. A name that is not a function gets a suggestion.- DuckDB statements Ursa does not have (
SUMMARIZE,PIVOT,UNPIVOT,INSTALL,LOAD,PRAGMA) and theUSING SAMPLEclause are refused with what to write instead, not with a parser error. TABLESAMPLEis refused. DataFusion parsed it but read every row, so a sample silently returned the whole table.ursa: CLI and semantics polish (#328).- A table shows at most 40 rows, as DuckDB's does: a longer result shows
its first 20 and last 20 rows, three rows of
·between them, and a footer,39,650,447 rows (40 shown)..maxrows N(in the shell, a script or an init file) and--max-rows Nchange it, with 0 for every row;--max-rowswins over an init file's.maxrows. CSV, TSV, JSON, NDJSON and Arrow still write every row. Before,FROM degree(g)on a 39.65M-node graph printed 39.65M lines. - SIGINT (Ctrl-C) cancels a
-c,-for stdin run:Error: interruptedon stderr, nothing more on stdout, exit status 130, and the database's lock released. Before, alouvainsent SIGINT ran to completion, printed its result and exited 0. In the shell, Ctrl-C still cancels the running statement and returns to the prompt, now also for an algorithm, and the shell exits at once afterwards. .timerreportsRun Time (s): real … user … sys …, as DuckDB does: CPU time in user code and in the kernel, over all threads, as well as wall time.- A syntax error names a place in the text you wrote. Before, its line and
column pointed into the text the
GRAPH_TABLEand FROM-first rewrites made of it. A reserved word used as a name says to quote it (`from` is a reserved word; to use it as a name, quote it: "from"). SOURCE KEY (from) DESTINATION KEY (to)works: the FROM-first rewrite no longer reads(from)as a query, which gave "Expected: ), found: *".- An unknown column that is part of a name with a
-in it (datefrom an unquoteddate-created) says to quote the name. - A date out of a nanosecond timestamp's range in
date_trunc(or another timestamp function) says to filter the dates or useextract(year FROM …), after arrow's cast error. - Docs:
degreecounts each parallel edge, and its reference shows how to count distinct neighbours; integer division and decimals in "Differences from DuckDB"; convert large vertex CSV files to Parquet once, in the database and statements pages. ursa: tables and prompt as DuckDB's. A table is a box drawn with line characters, each column's type under its name (Arrow's name for it, asDESCRIBEandarrow_typeof()give it), numbers aligned right andNULLfor a null. In a terminal it fits the terminal's width: long values are cut short and middle columns left out, with a…column and a footer,17 columns (10 shown);.maxwidth Nsets the width. Types and nulls are dimmed unlessNO_COLORis set. The prompt names the database,memory Uorclub Uforclub.ursa, and a statement's next lines are indented to line up with it instead of starting...>, so a statement copied from the terminal is still SQL. The browser shell draws tables with the same code, the new crateursa-shell.ursa: the shell is a library, and the browser runs it. The shell (dot-commands, SQL a line at a time, output formats) moves fromursa-clitoursa-shell, andursa-wasm'sWebShellis that shell for a page's terminal, as DuckDB's web shell is DuckDB's CLI: fed the Getting Started script a line at a time it prints whatursaprints..helplists the commands as DuckDB does,.help PATTERNthe matching ones,.help graphis a page on the graph SQL and.help shortcutsthe keys. New.versionand.print. In a colour terminal what is typed is highlighted (keywords, strings, comments, dot-commands), the prompt is orange, and errors are red.- Ursa Web Shell: a guided tour, and "Try it live" links from the docs
(#391, and the discoverability half of #390). The Datasets menu's first
item,
Tour: the karate club(also.tour, or?dataset=tourin the URL), tells one story in five steps, each with a comment for a newcomer: the club's data and its property graph, PageRank (the two leaders come out on top), Louvain (its two factions match the club's real split for 33 of 34 members), a drawing of the club, and every shortest path between the two leaders withGRAPH_TABLE … ALL SHORTEST. Its tables fit a phone. The karate dataset stays as it was, next to it. Each dataset now ends with a comment that says how to draw it (.graph lesmis; for rmat, that the layout takes a few seconds), and.helpstarts with.tourand.graph. The README, the SQL docs' landing page and the website (its landing page, the docs' overview, Introduction and Quickstart) link to the shell with their example preloaded, as a Share link that shows its statements and runs them ony, or with?dataset=.web/scripts/share-link.tsmakes such links, encoded as the shell's Share does. The e2e test runs the tour on a phone and replays every docs link. - Ursa Web Shell: a start hint. Under the banner, one line points to the
sample graphs:
Pick a sample graph from the Datasets menu, or type .dataset karate(broken between words on a narrow screen). - Ursa Web Shell: the browser e2e suite runs in CI (#392). The "Ursa
Shell (browser e2e)" job builds the engine and the page, stages the sample
datasets locally, serves them as the Worker does and runs
web/tests/e2e.tsin headless Chromium, on pull requests that touch the shell or the crates in it; screenshots and logs are uploaded when it fails. - Ursa Web Shell: the Graph view.
.graphdraws the last result as a graph in a pane beside the terminal (under it on a phone), and so does the new Graph button: each row is an edge from itssrccolumn to itsdstcolumn, or else from its first column to its second, with ids of any type..graph QUERYdraws a query's result and.graph NAMEa property graph (every edge table, and every vertex, edges or not) or a table. The shell says what it draws,Drawing 78 edges, 34 nodes (Esc closes), and keeps the keys: queries can be typed while the graph shows, and the terminal refits to its half. The drawing isursa-viz's (WebGPU, or else WebGL2), its ForceAtlas2 layout converging live in a worker, nodes sized by degree: drag or the arrow keys pan, the wheel or+and-zoom, a double-click or0fits, and a click names a node. It is ink on white by day and starlight by night. Esc or the close button closes it; New and the Datasets menu do too. It is loaded on the first.graphonly (about 1 MB gzipped), and draws at most 2,000,000 edges.WebShell.graph(text)gives the page the graph: node ids mapped to dense indexes in the order they are first seen, with clear errors when there is nothing to draw. - Ursa Web Shell: pinch to zoom the Graph view (#428). A phone had no
way to zoom: one finger panned, and the wheel and
+/-need a mouse or a keyboard. Two fingers now pinch: the view zooms by the change in their distance around the point between them and pans as that point moves, so what is between the fingers stays between them. A second finger cancels the first one's tap, a finger left down after a pinch goes on panning, and a double tap fits the graph in view, as a double-click does. The canvas draws at most 2 pixels for each CSS pixel, so a phone with a ratio of 3 fills under half the pixels each frame. The mouse, the wheel and the keys are as before. - Ursa Web Shell: sizes, colours and a legend for the Graph view
(#389).
.graph [SOURCE] [NODES (query)] [SIZE BY x] [COLOR BY y]:.graph karate SIZE BY pagerank COLOR BY louvainsizes nodes by PageRank and colours them by Louvain community. x and y name a column ofNODES (SELECT id, … FROM …), a vertex column of the property graph,degree, or a per-node algorithm, run on the graph with defaults throughalgorithms(G, …)and joined on id. A query or the last result takesNODESanddegreeonly. Errors say what fits: an unknown name lists the graph's columns and the algorithms,SIZE BYtext suggestsCOLOR BY, and too many categories suggestsSIZE BY.COLOR BYcolours the eight largest categories and draws the rest as "other"; the pane's legend names what sizes the nodes and each colour's category and count. The engine does it all (WebShell.graphreturnssize,colorand the legend; with no clause, the graph as before). - A spike: the graph view's layout on threads in the browser (#503).
Nothing in the release changes.
spikes/viz-threadsbuildsursa-viz's layout twice from one source, unthreaded on stable and threaded on a pinned nightly (+atomics, a rebuiltstd), and runs the threaded one on a pool of Web Workers over one sharedWebAssembly.Memory. On four cores in Chromium the layout is 2.0 to 2.3 times faster, with the same bits as the unthreaded build at every thread count, for 33 KB more gzipped and about 25 ms more start-up. The report and its recommendation (yes, as an optional build) aredesign/threaded-layout-spike.md. A CI job of its own,Threaded layout spike, runs the determinism check when the spike changes. - Ursa Web Shell: the page runs cross-origin isolated (#429). Every
response, from the Worker and the local preview alike, carries
Cross-Origin-Opener-Policy: same-origin,Cross-Origin-Embedder-Policy: require-corpandCross-Origin-Resource-Policy: same-origin, beside the Content Security Policy.crossOriginIsolatedis true on the page and in the engine's and the layout's workers, which gives precise timers andperformance.measureUserAgentSpecificMemory()now, and is what a build with shared memory would need. Every resource was same-origin already, so datasets (by range), Import, downloads, Share links, fonts and the Graph view work as before. - Web shell:
GROUP BYdraws a graph as its groups, and a group opens in place (#499)..graph karate GROUP BY clubdraws a disc for each club and the ties between the clubs, counted;.graph rmat GROUP BY louvaindraws a million edges as their communities, within a quarter of a second of the algorithm's result. What groups the nodes is a column ofNODES (query), of the result's rows or of the graph's vertex tables,degree, or an algorithm, found asCOLOR BYfinds it. A disc's area is its share of the nodes, an edge's width its count, and each says its number; more than 2,000 groups are the 2,000 largest and one "other". A double-click on a disc (or.expand group:N) adds the group's members and the edges among the members of the open groups (induced_edges), laid out inside the disc;.collapse group:Ncloses it, and.undotakes the members away. After a query,GROUP BYis the clause when the query is in parentheses.ursa_engine::graph::viewhas agroupsmodule,Style::group,GraphView::groupsandSession::grouped;ursa-viz's level scene draws open discs and points (LevelScene::set_kinds), and a view's fit can leave room for discs (View::set_fit_padding). -
Web shell: a graph is drawn from saved positions, and the edge cap is a setting, 5,000,000 by default (#502).
.graph … POSITIONS (SELECT id, x, y …)draws each node where the query puts it and runs no layout, so a graph too large to lay out while you wait is laid out once:CREATE TABLE pos AS SELECT * FROM layout_fa2(g)(or, in the CLI,COPY (SELECT * FROM layout_fa2(g)) TO 'pos.parquet'), then.graph g POSITIONS (SELECT * FROM pos). The ids are matched to the drawing's keys.layout_fa2's rows are where the view's own layout leaves each node, to the bit (centred on the origin), so the picture is the same; on the 1M-edge R-MAT graph its first frame comes 0.35 to 0.47 s after the engine's answer, where the live layout ends after 5 to 6 s. A node the query has no place for is placed beside its neighbours by one warm pass, the others held, and the status line says how many were. The most edges a view draws is nowursa.graph_max_edges: 5,000,000 by default (it was a fixed 2,000,000), 500,000 where the page finds a phone (a coarse pointer and at most 4 GB of memory),0for no limit; a refusal names the setting and theSETthat lets the result through. Above 2,000,000 edges withoutPOSITIONS, the status line and the terminal say how to save the positions.ursa_engine::graph::view::GraphViewhas apositionsfield, andStyleapositionsclause. -
Graph view: a large graph is drawn aggregated, and opens as the view zooms in (#498). Zoomed out, a million edges are a blot. Once a graph of 200,000 nodes and edges or more is laid out, the view draws a cut through its layout's hierarchy in its place: a disc for each group of nodes, the coarsest groups whose discs stand 20 pixels apart on screen, with the merged edges between them, the largest groups labelled with how many nodes they hold. The status line says so first:
aggregated: 92 groups of 46,318 nodes · 1,000,000 edges · …. The layout worker makes the cut again each time the camera comes to rest, opening only the groups in view; meanwhile the last cut is drawn, moved as the camera is. Zooming in reaches the graph's own nodes, and from there the drawing is the graph's own, byte for byte. A click on a group selects its nodes (Shift adds another group's), and a disc with a selected node in it carries a ring, so.findshows where its matches are.ain the pane, or.graph detail on, draws every node and edge as before;.graph detail offaggregates again. On.graph rmat(headless Chromium with no GPU): 92 discs and 2,389 merged edges at the fitted zoom; a cut takes the layout worker 10 to 12 ms at the median and 26 at most in two runs of three (35 in the third; 30 are allowed), after 44 to 48 ms once to prepare; the worker's memory is unchanged at 55.6 MB. Layouts are bit-identical. ursa-core:Fa2Multilevel::level_members; a layout keeps each level's members when it comes down from it (under 1 MB at a million edges).ursa-viz:cut(Hierarchy,Cut,CutParams);LiveLayout::cut,prepare_cut,has_cutandcut_bytes;LevelScene::discs_by,pickandset_max_radius;View::set_cut,draws_cut,pick_group,group_nodes,group_of,group_labelsandcut_info. In the browser:Layout.cut,prepareCut,hasCutandcutBytes;GraphView.setCut,cutInfo,pickGroup,groupNodes,groupOf,selectGroup,groupLabelsandcamera. The edges of a selection of more than 10,000 nodes are not drawn wide.- Graph view: a large graph is first seen as the coarsest level of its
layout, and refines level by level (#497). The coarse-to-fine layout
works down a pyramid of the graph; until it reaches the graph itself, the
view now draws the level being laid out: a disc for each of its nodes,
with area by the mass of the nodes it stands for, and its heaviest merged
edges, as wide as the number of edges each stands for. Each new level's
nodes move out from their parents over 150 ms (at once under
prefers-reduced-motion), and the status reads… · Laying out · level 3 of 11 · 110 groups. The graph's own nodes and edges are first drawn when the layout reaches them. On.graph rmat(a million edges, headless Chromium with no GPU) the first frame is shown 0.94 s after Enter where it took 1.13 to 1.23 s, and shows the drawing's shape; the levels' frames come 33 ms apart at the 95th percentile. The layout ends on the same positions, bit for bit. Graphs under 200,000 nodes and edges are drawn as before. ursa-core:Fa2Multilevel::step_level,level_positions,level_mass,parents_below,level_edges(LevelEdges),level_finishedandprolong. Building a hierarchy gathers each coarse row without sorting its edges (the same sums, in the same order): 225 ms where it took 336 ms for the 1M-edge R-MAT graph on one core.ursa-viz:LiveLayout::step_level,level_graphandlevel_positions;levels(LevelGraph,LevelScene) andlevel_render;View::set_level,set_level_positions,clear_level,level_infoandwarm_levels. In the browser:Layout.stepLevel,levelGraph,levelPositions,levelFinishedandwork;GraphView.setLevel,setLevelPositions,clearLevelandlevelInfo.- The graph view at rest is drawn in slices, and kept: nothing waits for
a million edges (#496). Where everything does not fit in a frame, the
frame at rest is no longer drawn at once (with no GPU, 2.5 to 6 s after
the layout, after every pan and zoom, and for every click and hover on
the view at rest, during which a zoom waited). It is drawn offscreen,
into one texture the size of the canvas: the edges a run of the buffer
at a time, then the nodes, each slice sized to take the GPU 16 ms and
sent when the GPU has finished the last but one. A pan or a zoom stops
the slices. The frame that follows them is the frame drawn at once, byte
for byte (read back on WebGL2: fitted, zoomed in, themed, highlighted,
after deltas); every frame at rest after it is that texture under the
highlighted edges and the nodes in front, so a hover or a click draws no
edge; and the frames of the next pan or zoom draw it under their own
edges and nodes, moved and scaled with the camera, so the full picture
stays on screen while it moves. The Graph pane's status line says
refining…while slices remain.ursa-vizgainsrefine(the slices' pace, and what a change of flags asks of the texture);View::plan_frame,draw_planned,refine,refining,snapshot_refinedandset_refining;Renderer::draw_sliceanddraw_over; and in the wasm APIrefine,refining,setRefining,snapshotRefinedandframeInfo().refining,refinedandrefinement. On.graph rmat(1M edges) in headless Chromium's software WebGL2, the slices take 2.2 to 2.9 s over three runs (what drawing it at once takes there, to a tenth more; up to 4.6 s on a busier machine) with no task of the page over 50 ms, and a click at rest is shown 90 to 140 ms after it (2.2 to 2.9 s). Not measured on a GPU, where the target is 0.3 s (ursa-viz/BENCH.md). - A frame budget for the graph view: pan and zoom no longer wait for the
graph's size (#495). While the camera or the positions change, a frame
draws a prefix of the edges and, where the nodes are too many as well,
the largest of them: as much as the last frames' costs say fits in a
frame (12 ms, or 1.3 of the display's refresh periods). At rest, 200 ms
after the last movement, it draws everything, the same pixels as before.
The edges are in importance order, so a prefix is a backbone of the
drawing: by the level of the layout's hierarchy at which an edge's two
ends merge, coarsest first, then one edge of each merged edge a round, the
heaviest first, then a hash (
Fa2Multilevel::edge_orderinursa-core; by the larger degree of the two ends where there is no hierarchy:edge_order_by_degree). The layout worker computes the order once (0.3 s at 1M edges) and the view writes it to the GPU a piece at a time.ursa-vizgainsbudget(the controller: it searches for the largest budget that fits, since a browser's frame cost is whole refresh periods) andorder;View::draw_frame,set_edge_orderandframe_info; and in the wasm APIrenderFrame,frameCost,framePartial,keepMoving,setEdgeOrder,orderEdges,frameInfo(alsoinfo().frame) andLayout.edgeOrder. On.graph rmat(1M edges) in headless Chromium's software WebGL2, frames of a scripted wheel zoom are 26 to 31 ms apart at the 95th percentile over three runs (3.3 s before; 25 to 46 ms on a busier machine), the first frame is shown 1.3 s after Enter (6.0 s) and the layout is done at 5.6 s (10.6 s), the page no longer rasterising a million edges for each set of positions; that renderer fits 512 to 1,081 edges and 170 to 360 nodes in a frame, and a frame at rest still takes it seconds. Not measured on a GPU (ursa-viz/BENCH.md). - Ursa Web Shell: the Graph view times itself (#430).
window.ursaShell.graphTimings()gainsframes(the count, and the p50, p95 and max of the time inrender()and of the time between frames while the view moves, over the last 120),pick(the last and the p95),actions(for each: the command, the ms in the engine, the ms applying its answer, and the ms from the input to the frame that showed it) andlongTasks(the page's tasks over 50 ms).graphMemory()gives each wasm instance's memory (engine, view, layout worker) andperformance.measureUserAgentSpecificMemory(). A frame's end is when the page's thread is free of it, not whenrender()returns: with no GPU the browser rasterises on that thread afterwards. Keeping them costs a frame three clock reads, a timer and two writes into arrays made once.web/tests/graph-timing.tsprints them, with the frame times of a scripted wheel zoom on.graph rmat. - Ursa Web Shell: the Graph view in each theme's own colours. The view
draws on the theme's background with its own edge ink and a categorical
palette stepped for white and for the dark sky, so the CSS inversion is
gone; switching the theme recolours an open view.
ursa-vizhassetTheme({background, edge, node, palette})and aThemein Rust, and itsLayoutalevelsgetter. - Ursa Web Shell: the Graph view says how far it is, and draws sooner
(#390). The pane shows "Loading graph view…" within a moment of Enter,
then "Laying out · level k of n", then the counts and "Done".
ursa-vizand the layout worker start loading while the engine runs the query, the layout gets the graph before the view is built, and nothing is drawn before its first positions:.graph rmat(1M edges) first draws 0.95 s after Enter in headless Chromium, from 4.6 s, and finishes its layout at 6.0 s, from 12.1 s. ursa: shell fixes.- A null in a column of type
Null(SELECT NULL AS n) showsNULL, as other nulls do; it was a blank cell. So does a dictionary's null value. - A table too wide for the screen is narrowed only as much as it needs: its widest values are cut first, and no shorter than the column's name, before any column is left out. Before, every long value was cut to 20 characters even when two would do. When columns are left out, a column too wide to fit no longer stops the others: the columns after it on the other side are still shown.
- The footer stays as wide as the table: the column count goes on a line of its own when the two counts do not fit on one, and is left out when nothing was left out. The space between the counts is at least two.
--max-width Nsets the table width from the command line, as.maxwidth Ndoes, and wins over an init file's.maxwidth.- Values are drawn as they are: bidirectional overrides, zero-width
spaces, line and paragraph separators and byte order marks are written
as escapes (
\u{202e}), as control characters were, and so are a column name's. Zero-width joiners are not: emoji sequences and the scripts that use them stay as they are. - A dot-command may end with
;(.tables;,.mode csv;), as.describecould. The start of a command (.q,.tab) gets a suggestion,did you mean '.quit'?, and is not run. .describe NAMEfinds a table or view in any case, as it found graphs (.describe Mixedfor a table created as"Mixed"), and reads NAME as a name:.describe v; SELECT 99is an error instead of two statements.- What is typed is coloured as part of the statement typed so far, in the
terminal and the browser: a string or comment left open on one line
goes on in the next, and a next line starting
.5is SQL, not a command.E'…'strings,$$…$$and$tag$…$tag$strings and nested/* /* */ */comments are coloured as they are read. - Ctrl-C during a
.readno longer counts it as still running; after 16, every.readfailed as nested too deep. --format arrowwith no query that returns a result is an error, not an empty output that exits 0, and.mode arrowsays to give--format arrowon the command line, in the shell and in a script.GRAPH_TABLEthrough the graph index (#325). The results are the same; what changes is how a match runs.- A node is bound when a condition on it alone names its keys:
a.id = 7,a.id IN (1, 2)ora.id IN (SELECT …). From a bound node, the fixed-length edges of its path are followed on the graph index, the onehopuses, each from the nodes the one before reached, rather than joined to the whole edge table:MATCH (a WHERE a.id = 7)-[]->(b)-[]->(c)reads only the edges at the nodes it reaches. On a 20M-edge R-MAT graph with a stored index, one edge from a bound node takes about as long ashop(see the PR for the numbers). - A node the query reads only the key of is not joined to its vertex table: its key comes from the index. A vertex table is scanned only for the properties the query reads.
- A path search whose last node is bound (
(b WHERE b.id = 9)) stops once it has that node's paths:ANY SHORTESTfrom one node to another takes about as long asshortest_path. EXPLAINshows each edge followed on the index as aPathSearchExecof one edge (-[]->{1,1}), and, targetson a search that stops at its last node;EXPLAIN ANALYZEcounts the path prefixes each search extended (expanded).- Edges are still joined when no node is bound, when the query reads an edge's columns, and when the edge table or its vertex tables are not files or views over files (an in-memory table's index is not kept).
- A missing property is named in the pattern's terms: "node 'a' has no
property 's'; its properties are club, id", with a hint to name an edge
to read its columns, where DataFusion named an internal relation
(
__ursa_1.s). - A new website for Ursa SQL, in
site/, to be served athttps://ursa.cldixon.dev: a landing page at/and the docs at/docs/, built with Astro and Starlight and laid out after duckdb.org's docs, ready to deploy as Workers static assets (workerursa-site; not deployed yet). The docs are the eightdocs/sql/pages, regrouped under Get started and Topics.docs/sql/stays, served by the Zensical site, until the cutover. ursa-cli's docs test runs the SQL on the new pages too (site_docs_run, with{/* skip */}for MDX), andfunction_reference_is_currentchecks the site's copy of the function reference as well. CI builds the site.- Zensical builds into
zensical-site/instead ofsite/, which is now the new website's source. - Coarse-to-fine ForceAtlas2, and the graph view lays out with it.
ursa_core::algo::layout_fa2_multileveland its incremental formFa2Multilevelcoarsen the graph (heavy-edge matching, with a hub's leftover leaves joining it, and isolated nodes set aside on a ring), lay out its 50-node top level, then refine each finer level in a few iterations. The output is the same bits on any thread count, and however the work is split into steps. On one core a 10,000-node grid comes out as a flat sheet in 2 s, where flat ForceAtlas2 leaves it folded after 1,500 iterations; a 16K-node R-MAT graph is as good in 3.5 s as flat after 17 s; clustered graphs separate as well as flat. Theursa-vizworker uses it by default (&multilevel=0in the demo for flat), drawing every node from the first frame: a 1M-edge R-MAT graph takes shape in about 8 s in the browser, where flat needs minutes.Fa2Stategainsstep_weighted(an attraction weight per edge) andfrom_positions(start positions and masses);layout_fa2andlayout_frgive the same bits as before. - ForceAtlas2 with fixed nodes and a warm start, for a layout that
grows (#442).
Fa2Stategainsset_fixed(a per-node mask: a fixed node is not displaced by a bit, and still repels and attracts),set_inertia(a per-node factor its displacement is divided by),extend(append nodes at given positions) andset_mass.ursa_core::algo::fa2_growputs them together for a view that expands a node: the new nodes start on a golden-angle spiral around the node they came from (place_new_nodes), pinned nodes and the expanded node are fixed, the old nodes within two hops of a new one get ten times the inertia and the rest are fixed, and 60 iterations settle it (warm_iterations;WarmParamshas the knobs). Fixed nodes have a quadtree of their own, built once (QuadTree::accumulate_at), so an iteration costs what the free nodes do: 100 new neighbours in a laid-out 1M-edge graph take 2 ms to place and 10 ms to settle on one thread, after 52 ms rebuilding the adjacency (fa2_multilevel's newgrowmode;ursa-viz/BENCH.md). Inursa-viz,LiveLayout::growandLiveLayout::from_positions, andLayout.growandLayout.fromPositionsin the wasm API; expanding a node to degree 16 in a 500-node view moves the old nodes 0.003% of the view's width on average. The same additions in the same order give the same bits on any thread count. A layout that uses none of this has the bits it had (tests/layout_golden.rs). - Rings and layers: fixed layouts for neighbourhoods and paths (#436).
ursa_core::algo::layout_ringsdraws ahopresult from each node's distance: the seed at the centre, distancedon the circle of radiusd, a crowded ring widened so that no two nodes are nearer than a quarter of a unit, and several seeds as one ring system each, side by side.layout_layersdraws paths from each node's position along them: layerlon the line atx = l, one path alone a straight line. The order on a ring or a line is chosen by four barycentre sweeps (ties by node index), and each node is then placed as near its neighbours' mean as its spacing allows. Neither iterates: 2 ms for 2,048 nodes and 8,334 edges, 0.3 s at 1M edges, on one thread (ursa-viz/BENCH.md). Both are serial, so the same input gives the same bits on any thread count; layers are the same bits on every platform. Inursa-viz,LiveLayout::ringsandLiveLayout::layers(done at once, and they grow like any layout),Layout.rings,Layout.layersandLayout.kindin the wasm API, and the shell's layout worker takeslayout: {kind, level}and posts one message. On karate, two hops from node 0 are two rings of 16 and 9 nodes, and all shortest paths from 16 to 26 are six layers, drawn without a crossing. No existing layout changes. - Layouts in SQL:
layout_fa2andlayout_fr(#395). Both are table functions of(id, x, y), like the algorithms, and work insidealgorithms(g, …), where their columns arexandy, or<name>_xand<name>_y(pos => layout_fa2()).layout_fa2is ForceAtlas2 coarse to fine by default (layout_fa2_multilevel);multilevel => falseruns it flat. Its named arguments areiterations(NULL: 300 flat, the size-based schedule coarse to fine; given, coarse to fine, the graph's own iterations, the levels above more),k,gravity,strong_gravity,lin_log,theta(NULL: 1.0 coarse to fine, 0.5 flat),jitter_toleranceandseed;layout_frtakesiterations,k,gravityandseed. Positions areursa-core's, bit for bit, and the same on any thread count, so they can be saved withCOPY … TO 'layout.parquet'. The layouts take no weight. A graph with a vertex table gives every vertex a position.layout_randomandlayout_circlestay hidden. The catalog gainslayout_fa2and anOptionalCountparameter type; the Python library hasursa._graph.layout_fa2, not yet exported, as the other layouts. - A graph-result model and a wire format for it, in a GPU-free
ursa-viz(#424).ursa_viz::modelis the data every drawing will be made of:GraphResult(nodes identified by a label and a typed key, so two vertex tables may reuse a key; edges with a label and their row;f32,u32and dictionary columns for both; paths, seeds and distances; encodings; the SQL and the rule that drew it) andGraphDelta(add, remove and restore nodes and edges, set columns, highlights, encodings and positions). Indexes are append-only and a removed node keeps its slot; every op carries its inverse, soapply(&delta)thenapply(&delta.invert())restores a result bit for bit, with no query.to_bytesandfrom_bytesspeak UGR (ursa-viz/UGR.md): a JSON header and aligned little-endian arrays, whichursa-viz/ui/ugr.jsreads as typed arrays over the buffer without a copy. A million edges are 8.5 MB. wgpu is now the crate'srenderfeature, on by default: withdefault-features = falseit builds with no GPU dependency, for the engine to produce results with. The view and the shell draw as before. -
Search in the Graph view:
/,.findandf(#445)..find TEXTselects the nodes of the drawn graph whose key starts with the text, then those whose label column (the vertex table's first text column) contains it;.find WHERE conditionselects by any SQL condition on the vertex table's columns (.find WHERE club = 'Officer'). The view selects the matches and moves the camera to fit them (200 ms, or at once underprefers-reduced-motion). At most 1,000 are selected, and the status says how many matched. Matches that are not drawn are named in the terminal and listed under the pane's header; a hidden one has a button that shows it again. In the pane,/opens a search box that runs.find, andffits the selection.--sqlprints the search's SQL. The engine's side isursa_engine::graph::view::find, run byShell::findandWebShell.find(command). -
Web Shell: double-click a node and its neighbours appear (#443). The Graph view now draws what the explore commands change. A double-click on a node (a double tap, or Enter in the pane with nodes selected) runs
.expand IDin the terminal as if typed: it is echoed after a dimmedfrom the graph, answered in one line, kept in.history, and replayed by a shared link, which now includes.graphdrawings and the explore commands that changed them. Shift expands withLIMIT 5000; a double-click on empty space still fits;.graph echo offruns these commands without writing them. The new nodes start beside their neighbours and the layout grows warm, the nodes already drawn held or slow..hideand.showare drawn too,.undoputs every node back where it was before the step, in one frame, and.redodraws the step where it had settled. While a command waits its turn its node carries a busy ring. A node with edges in the graph that lead to something not shown says+N, in its tooltip and in the header when it is selected (no badge is drawn: there is no label overlay yet); the count is the engine's (Session::not_shown,Shell::not_shown,WebShell.notShown()). Each expansion is an action ingraphTimings(). On the million-edge R-MAT dataset, from ahopresult, a double-click's frame comes 118 to 190 ms after it in headless Chromium. The pane's view is now made withcreateViewFromResult, so that deltas apply to it. Such a view also draws the result's own highlights: a path's route is highlighted, with the rest dimmed, and ahop's seeds are ringed (a seed alone dims nothing, so a neighbourhood and what is expanded from it stay at full strength). It costs more for a whole graph: at 1M edges the view's heap is 60 MiB (it was 16) and decoding the result is one 63 to 92 ms task on the page's thread. - Exploring a drawn graph from the terminal:
.expand,.hide,.show,.undo,.redoand.graph history(#440). The engine now keeps an explore session for the graph.graphopened (ursa_engine::graph::view::Session): the graph as it stands, with its(label, key)→ node map and what is shown, and the history of steps. Each command is a line in the Web Shell's terminal, answers in one line (+16 nodes, +41 edges, or why nothing changed) and gives the change as a UGR delta for a view to apply..expand ID [in|out|both] [LIMIT n]adds a node's neighbours that are not shown (hop), the 100 of highest degree first and then by key, so the same command always adds the same nodes, and the graph's edges among every node (induced_edges); expanding again adds the next ones..hide ID…and.show ID…|allhide nodes and bring them back with their edges;.undoapplies the inverse of the last step with no query, and.redothe step again.--sqlprints a command's SQL instead of changing anything, and.graph historylists the steps. With no open graph, or an id that is not a node of it, the command says so.ursa-shelllists the commands in.helpand runs them (Shell::open_graph,Shell::explore);ursa-wasmaddsWebShell.explore(command)and the engine worker anexploreop. The page's pane draws the deltas since #443. .graph … AS edges(…) | nodes(…) | path(…) | hops(…),ON graphandLAYOUT(#434). The Web Shell's.graphtakes three more clauses, in any order after its source, besideNODES,SIZE BYandCOLOR BY.AS …says what a result's rows are and names the columns, in place of the rules (it is rule 0, and nothing is inferred), so a result whose columns have any names is drawn:.graph SELECT a.id AS x, b.id AS y FROM … AS edges(x, y). The forms areAS edges(src, dst [, weight]),AS nodes(id),AS path(nodes [, edges])andAS hops(seed, id, distance); the refusal of a result that is no graph already named them.ON graphnames the property graph the ids belong to: whereAS nodesandAS hopsread their edges, and whatSIZE BY pagerankruns on for rows drawn as edges.LAYOUT force|rings|layerssets the layout, whatever the rule chose. A column that is missing or of the wrong type is an error that names it, lists the result's columns and their types, and says what the form needs; every other misuse (a form that is not one, the wrong number of columns, a clause given twice, a graph that is not there, rings for a drawing with no distances, a clause on a property graph) says what to write..help graphlists the clauses.ursa-engine'sgraph::viewgainsAs,Style::{shape, on, layout},interpret_withandUSAGE..graphdraws what a result means (#433). After a graph query, the Web Shell's.graph(ursa-engine'sgraph::view) now reads what each column is, from theursa.*metadata the graph functions andGRAPH_TABLEwrite and else from its name and type, and draws the result by the first rule that matches: paths (vertices(p), withedges(p)orelement_id(p), the steps ofshortest_path(), or a list of ids) as the union of the rows' paths; ahopresult (seed,id,distance) as its seeds and the nodes reached, with the graph's real edges among them and coloured by distance, where it drew a star; edges as before (src/dst, now alsosource/targetandfrom/to, two pattern variables, or the first two id columns); pattern matches of three or more node variables as every edge of the pattern, where it drew only the first two columns; and nodes (pagerank,algorithms, a table with anid) with the graph's edges among them (induced_edges), sized by their first metric and coloured by their first category, where it refused or drew each id tied to its score. What is no graph says what its columns are and what would draw them. The pane's status line and the terminal say what the result was drawn as (drawn as a path on karate (members, ties)). A result's provenance (UGR) gainsrolesandnotes, and its highlights carry the paths, the seeds and each node's distance or step, with the layout the rule asks for. A plain edge table is drawn as it was: the same nodes and edges, in the same order..graphis resolved in the engine (#425). What turns a source and itsNODES,SIZE BYandCOLOR BYclauses into a graph moved fromursa-wasmtoursa-engine(graph::view), so the CLI and the notebook can draw what the web shell draws. It writes aursa_viz::model::GraphResult: the ids as nodes of one label with typed keys, the edges, a node column forSIZE BYand a dictionary column forCOLOR BY(every category, the largest first) which the encodings name, and the SQL and the rule that drew it (edges, orgraphfor a property graph).GraphView::legendgives the legend.ursa-enginedepends onursa-vizwithout its default features, so no GPU code is in the engine or the CLI;ursa-vizis now published with the engine's crates. SQL text is run through aRunSqlthe caller hands in (ursa_sql::Sql), sinceursa-sqldepends on the engine. In the web shell,WebShell.graphreturns one UGR buffer, which the worker transfers andgraph.jsreads withursa-viz/ui/ugr.jsas typed arrays over it, in place of an array copied per getter. What.graphdraws, its messages and its legend are unchanged.- An inspector in the graph view, and edge picking (#444). Selecting a
node in the web shell's Graph view opens a panel with its key, its degree
as drawn and its neighbours in the whole graph, the values drawn, and its
row of the vertex table, read with one query by key. A click within 4 px
of an edge selects the edge, and the panel shows its ends and its row of
the edge table. Several selected nodes show their count, the edges among
them and a
WHERE id IN (…)clause to copy. Buttons run.expand,.hide, a shortest path, and.graphwithCOLOR BYorSIZE BYa property, in the terminal;imoves the focus to the panel and Esc back. New:ursa_engine::graph::view::inspect,Shell::inspect,WebShell.inspectNodeandinspectEdge, and inursa-vizinteract::nearest_edge,pickEdge,selectEdgeandselectedEdge. - A spatial grid in the graph view: a pick reads the nodes near the
pointer, and a zoomed-in frame draws the nodes in view (#500). With the
positions at rest,
ursa-vizkeeps a uniform grid over them and a pick or a hover tests the nodes in the cells around the pointer: 6 to 22 µs at a million nodes, where testing every node took 3.6 to 4.9 ms on every pointer move; the grid is built in 10 to 12 ms. An edge pick reads a grid of the edges by length. Zoomed in so that under half the nodes (and at most 65,536) are in view, the node pass draws those alone: under 3% of the instances at 1% of an R-MAT drawing. Every pick is the pick that tests everything, ties included, and the culled frame is the whole frame byte for byte; while a layout moves the nodes, picks test every node and frames draw every node, as before. A frame and a pick no longer add up every node's area to size the nodes. New inursa-viz: thespatialmodule (NodeGrid,EdgeGrid,Discs),View::prepare,View::pick_edge, and in the wasm APIgridReady,rebuildGrid,nodesDrawn,setCulling,pickLinearandpickEdgeLinear.View::picktakes&mut self. - Hover and selection in the graph view (#438). In the web shell's
.graphpane, a mouse or a pen over a node rings it and shows a tooltip (its key, label,SIZE BYandCOLOR BYvalues and degree), looked up once a frame at most. A click selects a node, Shift+click adds one (or takes it out), and a click on empty space clears the selection; the selected nodes carry a ring and their edges are drawn wide. The pane's header, a live region, readsSelected node 33: …in place of the node a click named. Esc clears a selection before it closes the pane. The selection set isursa-viz's newinteractmodule (no GPU), which the wasm view exposes asselect,selection,clearSelection,hover,hoveredandselectionEdges. - A highlight layer in the graph view (#435): a path, a selection or a
hover can be seen.
ursa-vizkeeps a flags byte per node (selected, hovered, pinned, dimmed, highlighted, hidden, seed) in a buffer of its own, and draws from it: a halo on highlighted nodes, a ring on a route's ends and on seeds, rings for the selection, the hover and pins, and nothing for a hidden node or its edges. Highlighted edges are instanced quads, 3 px wide with round ends, over the line list. While a highlight is set, everything else draws at 35%.GraphViewgainssetHighlights(UGR's path and seed sections),clearHighlights,setSelection,setHovered,setPinned,setHidden,setFlags,flags,setHighlightEdges,nodePixeland theNodeFlagbits; in Rust,ursa_viz::highlight::HighlightState(no GPU) andView::set_result_highlights, which reads aGraphResult's highlights and removed nodes.ThemeandsetThemegainhighlight,selectionandpin, at least 3:1 against the background in both built-in themes, and the shell's stylesheet the matching--graph-highlight,--graph-selectionand--graph-pintokens. It is all vertex buffers, so it draws on WebGL2 as on WebGPU. Setting a highlight uploads the flags that changed and 16 to 20 bytes for each highlighted edge and node, never the graph's edges; a selection of one node uploads 24 bytes. At 1M edges a frame with a path highlighted costs within 3% of one without (ursa-viz/BENCH.md). The shell does not drive the layer yet.View's methods that upload (step,set_positions,set_style,color_by,set_theme) now take the device as well as the queue. - Making the graph view costs an upload, not a graph build (#426). The
page's view no longer builds a topology, an undirected adjacency and a
layout state to read degrees and starting positions: degrees are counted
from the edge list, the nodes start where a layout would seed them
(
ursa_core::algo::fa2_seed_positions), the edges go to the GPU a run at a time, andcreateViewandcreateViewFromResultgive the event loop a turn between compiling the shader, linking each pipeline and the uploads. At 46K nodes and 1M edges in headless Chromium,createViewwas one task of 190 to 350 ms on the page's thread and 50 MB of wasm memory; it is now no task over 50 ms and 16 MiB.View::stepbuilds the adjacency on its first call. In Rust,View::newtakes the queue as well as the device,View::new_pacedandView::from_result_pacedare what a page calls,Renderer::newtakes the edge count and the caller writes the edges (write_edges), andGraph::line_indicestakes a range.tests/graph-timing.tsprints the longest task while the view is made and fails over 60 ms. The shell keeps what its layout worker says while the view is being made, so a small graph's layout that ends first is not lost. - The graph view holds a million edges in 74 MB, not 164 (#501, with
#492). On
.graph rmatin the Web Shell (46,318 nodes, 1,000,000 edges) the page's view holds 17.9 MiB of WebAssembly memory where it held 59.6, and the layout worker 55.7 MB where it held 101; no task of the page's is over 60 ms while the view is made (decoding the result was one of 63 to 92 ms); and a position update is copied twice on its way from the layout to the GPU, not six times. Layouts are the same, bit for bit. - The page's view.
createViewFromResult(canvas, bytes)takes theUint8Arrayand reads the result out of it a section at a time, with turns of the event loop between (GraphResult::read_pacedover amodel::Source,View::from_ugr_paced), so the buffer is never copied whole into the view's memory. A view made from a result keeps no second copy of the edges (View::edgesreads the result's;View::graphis gone, forn_nodes,n_edgesandedges). Edge labels and flags that are all zero hold nothing (model::Sparse, whichedge_label()andedge_flags()now return); the key index is a table of node indexes over the result's own keys;GraphResult::reserveno longer doubles what it was asked to grow by a sixty-fourth; a paced view waits for the GPU to take each run of edges, so WebGL2's staging is freed as it goes; andresultBytes()writes the result into aUint8Arraya section at a time (GraphResult::encoded). - The layout worker. A layout reads a graph's undirected adjacency
and nothing else, so that is all that is built
(
UndirectedCsr::from_edges, the same adjacency asTopology::undirectedwithout the topology), andGraph::topologyisGraph::adjacency.Fa2Multilevel::new_lean, whichLiveLayoutuses, holds the weights of a coarse level that grouping does not thin only while that level is laid out, and every level is released once the layout is past it: same positions at every step, for one more contraction for each such level between it and the graph (six at 1M edges on R-MAT, none for a graph whose levels shrink). - An adjacency can travel with a result. UGR has optional
edges.adjacency.offsetsand.targetssections (GraphResult::to_bytes_with_adjacency,ugr::read_adjacency,ui/ugr.js'sedges.adjacency), whichLayout.fromAdjacencyandLiveLayout's_onconstructors use as they are, checked in one pass (UndirectedCsr::from_parts) and with nothing sorted; the page hands one to its worker when a result has it. The engine does not write them yet:.graphnumbers a drawing's nodes as it reads them, not as the graph's index does, so it has no adjacency in the drawing's numbering to give. - Positions.
Layout.positions()andGraphView.positions()return aFloat32Arrayfilled straight from the layout's or the view's memory, andsetPositionstakes one and copies it once, into the positions the view keeps and uploads. - The edge order of #495, within the same memory.
Layout.edgeOrderreadssrcanddstfrom the caller'sUint32Arrays a run at a time, keeps the sort keys in aBigUint64Arrayoutside its WebAssembly memory and sorts them there (Fa2Multilevel::edge_order_keysover anOrderKeys), so the worker's memory does not grow by the order (it grew by 11 MiB). On a lean hierarchy the weights it ranks by are counted again from the adjacency, two bytes an entry, and the order is the same;edge_ordertakes the input adjacency for that, and after the layout has come down a level gives the order by degree.GraphView.setEdgeOrdertakes theUint32Arrayand reads it a run at a time (order::EdgeOrder), andorderEdgeswrites 65,536 edges a call and waits for the GPU to take them, so the view does not hold the order or its staging (6 MiB). Ordering a million edges takes the worker 510 to 620 ms where it took 285 to 325. - Measured.
graphTimings().memorygives{edges, view, layout}, each instance's bytes and bytes an edge, andtests/graph-timing.tsfails over 20 MiB for the view or 60 MB for the worker on rmat.ursa-viz/tests/memory_scale.rscounts every allocation of a view and a layout at a million edges, in CI. - Scenes that change in place in the graph view (#441): a view made
from a graph result applies a delta in time proportional to the delta, not
to the graph.
createViewFromResult(canvas, bytes)takes a result as UGR andGraphView.applyDelta(bytes, positions?)a delta: new nodes and edges are written after the ones there are (the GPU buffers grow by doubling, what they held copied on the GPU), a removed node is hidden by its flag and a removed edge in its slot, and only the nodes whose radius or colour a delta changed are written. Sizes and colours follow the result's encodings (size_by,color_by; by degree without). Undo is the inverse delta (invertDelta(bytes)) with the positions saved before the step: no index changes, and a delta and its inverse leave the frame as it was, bit for bit, which the browser tests read back on WebGL2.GraphView.info()gives what a status line and a legend show (shown and hidden nodes and edges, what sizes the nodes, the colour legend with counts) and follows every delta. In Rust:View::from_result,View::applyandapply_at,View::info, andursa_viz::live::LiveResult, the bookkeeping without a GPU. A delta of 100 nodes and 300 edges on a view of a million edges uploads 5 KB and takes 0.5 ms in Chromium (ursa-viz/BENCH.md).scene::Graphgainsappendandtruncate, and builds its adjacency again only when a layout asks;GraphResultgainsreserve, and taking nodes off its end no longer reads every edge.Theme::colorsdraws the categoryu32::MAX(none) in the node colour. The shell's.graphdoes not send deltas yet. - A benchmark for the graph view (
ursa-viz/BENCH.md).bun run benchinursa-viz/runs the demo in Chromium on R-MAT graphs and grids of 1K to 1M edges, under WebGPU and WebGL2, and records time to first frame and to layout done (coarse to fine, and flat per iteration), synced frame times while panning and zooming (median and p95), pick latency, wasm and JS memory, and bytes uploaded; then the layout alone natively, on one thread and on all (fa2_multilevel's newbenchmode). It writesbench/results.json;bun run bench:reportmakes the tables. The baseline, from a container without a GPU: a first frame in 0.1 s up to 100K edges and 1.1 s at 1M, a layout done in 8 s for a 1M-edge R-MAT graph and 32 s for a 1M-edge grid, wasm 1.4 times slower than native on one thread. Not in CI. - SQL: a result says what its columns are (#431). Every graph function
and
GRAPH_TABLEmarks the columns it returns with Arrow field metadata under anursa.prefix, so a reader (the Graph view, a notebook) does not guess from names. No value, column name or type changes. ursa.roleis what a column is:node(an algorithm'sid),metricorcategory(its output:pagerankis a metric,louvaina category),seed,nodeanddistance(hop),src,dstandstep(shortest_path),walk,stepandnode(random_walk), and inGRAPH_TABLEnode(a node variable's key),property,path_nodes(vertices(p)),path_edges(edges(p)) andpath_elements(element_id(p)).ursa.graphnames the property graph,ursa.labelthe vertex or edge table, andursa.varthe pattern variable. AGRAPH_TABLE's schema hasursa.pattern: the pattern's edges as JSON, each with its two node variables and its direction.- The metadata follows a column through
SELECT,AS,WHERE,ORDER BY,LIMIT,DISTINCT, subqueries, views, joins,UNIONandGROUP BYkeys. A computed column (round(pagerank, 4),id + 1) has none. In an inner join, a plain column equated with a node's key (FROM members JOIN pagerank(g) USING (id)) is marked as a node too. COPY … TOa Parquet or an Arrow file keeps it: the file remembers its graph.arrow_metadata(column, 'ursa.role')reads it in SQL.- Docs: a "Result metadata" reference page.
- SQL:
induced_edges(g, nodes => …), the graph's edges among a set of nodes (#432). A traversal likehop:nodesis a list, a query of one column, or one id, and each row is an edge whose two ends are both in the set, assrcanddst(in the direction the graph stores) andedge, its row in the edge table asedges(p)numbers it. Parallel edges are rows of their own, rows are ordered byedge, and an id that is not in the graph is on no edge. It reads the index (a stored one where there is one): the nodes are marked in a bitmap and each one's out-edges walked, so the time is the sum of the nodes' out-degrees, whatever the graph's size. The same rows fromWHERE src IN (…) AND dst IN (…)on the edge table cost a scan of it. The columns carry theursa.*metadata (src,dst, and a new role,edge).ursa_core::algo::induced_edgesis the kernel. - In the browser's engine, on the 1M-edge R-MAT graph: the 4,832 edges
among 5,000 nodes in 12 ms with the nodes from a query and 18 ms with
them as a list, where the edge-table scan takes 190 ms; a two-ring
hopneighbourhood and its 9,926 edges in 20 ms, where the scan form takes 120 ms. From a stored index, natively, a fixed 20,000-edge answer among 5,000 nodes takes 20, 21 and 27 ms on graphs of 125K, 1M and 4M edges (an unoptimized build; 32 times the edges, 1.3 times the time). - A list of 65 or more literal node ids (
seeds => [3, 17, …],nodes => […], for every traversal) is planned as one column in memory instead of one expression per id: the same rows and the same errors, and 5,000 ids plan in a few milliseconds instead of 70.EXPLAINshows it asTableScan: node_ids. - Parallel Louvain, opt-in:
louvain(g, parallel => true)(#387). In Pythonur.louvain(edges, parallel=True); in Rust aparallelargument toursa_core::algo::louvainandlouvain_weighted. Local moving runs in 64 fixed sub-rounds of the seeded visit order: the nodes of a sub-round choose their community in parallel against the state at its start, and the moves are applied in order. The same seed gives the same labels on any number of threads, but not the labels the serial default finds, and NetworkX has no equivalent. The default stays serial and its results are unchanged, bit for bit. - Pinned instead by: the same labels and modularity bits on 1, 2, 3, 4 and 8 threads; golden label hashes on karate, planted-partition and R-MAT graphs; and a mean modularity within 2% of the serial run's on the same graphs (measured: from 1.5% below to slightly above).
- Two single-node communities in one sub-round could swap for ever, so a single node joins another single node of its sub-round only if that one has the lower id. A level stops when a sweep moves fewer than one node in 1,000, or its real modularity gain (not the movers' estimates) is under 1e-7, or after 64 sweeps.
- Memory: each thread keeps a hash table sized to the degree of the node it is on (a dense array only for a hub as large as the graph), not one entry per node; each sub-round keeps a list of its active nodes, so late sweeps do not scan the graph; isolated nodes are skipped as in the serial run (#326). Peak memory is the serial run's.
- On a shared 4-core machine: R-MAT at 80M edges in 22.3 s instead of 41.9 s, and planted-partition graphs at 80M edges in 75.5 s instead of 159.0 s (30% of edges between communities) and 123.3 s instead of 333.9 s (60%), at 3.5 cores busy instead of 1.1, with the same peak memory and modularity from 0.7% below to slightly above the serial run's. On one thread it does about 1.7 times the serial run's work.
examples/louvain_memory.rstakes--parallel, and--planted Pfor a planted-partition graph with P% of edges between communities.- Parallel label propagation, opt-in:
label_propagation(g, parallel => true)(#453). In Pythonur.label_propagation(edges, parallel=True); in Rust aparallelargument toursa_core::algo::label_propagation. The frame of parallel Louvain: each sweep takes 64 fixed sub-rounds of the seeded visit order, the nodes of a sub-round vote in parallel against the labels at its start, and the new labels are written in order. The same seed gives the same labels on any number of threads, but not the labels the serial default finds (on a graph of at most 64 nodes it is the serial run), and NetworkX has no equivalent. The default stays serial. - Two neighbours of one sub-round would trade labels for ever (the two-colouring of synchronous label propagation), so a node does not read a higher label than its own from a node of its sub-round. Without that rule, 14 nodes of the R-MAT graph below still traded labels in the 20th sweep; with it, the run stops after a sweep that changes nothing, in as many sweeps as the serial run (5).
- Pinned by: the same labels on 1, 2, 3, 4 and 8 threads; golden label hashes on karate, planted-partition and R-MAT graphs, masked and not; and, on planted-partition graphs, a modularity no more than 1% below the serial run's and a community count within 2% of it (measured: within 0.2% for both).
- Each thread keeps a table sized to the degree of the node it is on, and each sub-round a list of its active nodes.
- Serial label propagation is 2.7 to 3.1 times faster, with the same labels (#453). A node votes again only once a neighbour has taken a label other than its own since its last vote; any other node would vote for the label it holds. On a shared 4-core machine, 32M edges, 20 sweeps allowed:
| graph | before | serial now | parallel => true |
|---|---|---|---|
| R-MAT, 2^21 nodes | 11.0 s | 4.0 s | 2.3 s at 3.3 cores |
| planted partition, 20% of edges between | 21.4 s | 7.5 s | 3.3 s at 3.6 cores |
| planted partition, 50% between | 35.0 s | 11.2 s | 4.9 s at 3.7 cores |
Peak memory is unchanged (605 MB, of which the graph is 575 MB) and 8 MB more for the parallel run. Without a mask, a vote no longer reads the edge ids.
ursa serve [DIR]: the shell in a browser tab, over a local WebSocket to the native engine (URSA-3,design/console.md§5; ursa-cli's non-defaultservefeature, over the new crateursa-server). It prints a link with a one-time token and serves the shell's page, which talks to a native session (web/public/socket-transport.js) with the same protocol the browser demo speaks to its wasm worker. Each tab gets a session of its own (hello {session: "new"}, as the shell asks), or attaches to the server's one shared session ("shared", the default).cancel {target}stops a running request with DataFusion's cancellation, and a closed tab cancels its own; Ctrl+C stops the server gracefully. It listens on127.0.0.1and::1only; the token becomes anHttpOnly,SameSite=Strictcookie, which the WebSocket and the served directory's files (/data/, with byte ranges read from the file) need; every request'sHost, and every WebSocket'sOrigin, must be the server's own; and every response has the deploy's security headers. The page's files come from--assets DIR(aweb/dist), or are built in withrust-embed(serve-embed, from a checkout).ursa-serveris published with the other crates, beforeursa-cli. Release binaries do not haveserveyet.- The shell's e2e suite runs in CI over both transports (URSA-5).
.github/workflows/shell-e2e.ymlruns a second leg, "Ursa Shell (browser e2e over ursa serve)", beside the worker one: it buildsursa-cli --features serve(debug) and runsweb/scripts/e2e-serve.ts, on the same triggers plus changes toursa-serverandursa-cli/src/serve.rs. The socket run skips exactly the suite's 6 browser-only checks, which the suite now lists and holds it to: a run that skips any other check fails. - SQL: DuckPGQ's algorithm names, and errors that point to the standard form (#298, #300). Each was an error before, so no query that ran changes.
weakly_connected_component(pg, Student, know)runsconnected_components(mode => 'weak')and returns DuckPGQ's column,componentid(unquoted names fold to lower case, so DuckPGQ'scomponentIdfinds it);local_clustering_coefficient(pg, Student, know)runsclustering_coefficientand returnslocal_clustering_coefficient. They take DuckPGQ's positional (graph, vertex table, edge table) form, the implied pair on a graph of one edge table, the named parameters of the function they run (notmode, which the name fixes), and work insidealgorithms(). Values stay NetworkX's.ursa_functions()lists them as rows of their own, afteralgorithms, and has two new columns:same_as, the Ursa function a DuckPGQ name runs, andduckpgq, true for the three functions DuckPGQ has by name (pageranktoo). They are other systems' spellings; Ursa keeps no old names of its own. The function reference shows them.- DuckPGQ's scalar path functions (
iterativelength,shortestpath,reachability,cheapest_path_length) say to useGRAPH_TABLE … ANY SHORTESTorshortest_path(). - A statement that starts with
MATCH(Cypher, GQL) says to writeSELECT * FROM GRAPH_TABLE (g MATCH … COLUMNS (…)).FROM g, a graph read as a table, says to readg.nodesorg.edges(or the vertex and edge tables, on a graph of several), useGRAPH_TABLE, or call a graph function;FROM g.nodeson a graph of several vertex tables says why there is none. A graph function named as a column of a vertex table (SELECT id, pagerank FROM Student) names the pair in the join it suggests:JOIN pagerank(pg, student, know) USING (id).pagerank(pg, vertex => Student, edge => know)says the pair is positional. -
Docs: a "Coming from SQL/PGQ or DuckPGQ" page (what runs unchanged, what differs, Ursa's extensions, the numeric differences from DuckPGQ, and how to translate), and a section in the agent skill. The conformance suite has a
duckpgq/directory for DuckPGQ's algorithm calls, and DuckPGQ's PageRank values are on its known differences. -
The console's result tabs (URSA-14,
design/console.md§6). Each result the console runs opens in a tab of its own, labelled with its statement and row count (the ARIA tabs pattern; Delete or × closes it and frees the result withclose). A tab shows its result as a table: Arrow decoded in the page, paged withfetchand drawn a screenful at a time, so 100,000 rows scroll smoothly; each header names its column's type andursa.*role; numbers right-aligned, NULL dimmed as the shell shows it, long text cut short with its whole value on hover and focus; a header sorts the loaded rows (and says so); a cell or a range copies as tab-separated text. A result whose columns make a graph has a Graph view, drawn withgraph.open {result}in the page's one graph pane, whose commands (a double-click's.expand 33) go to a sink History will take (results.setCommandsSink), listed under the graph until then. A Plan view showsexplain, and Export downloads CSV, Parquet, JSON or Arrow. A result the session has dropped (not_found) offers Run again. A statement with no columns says its notices instead of opening a tab.ursaConsole.run(sql)runs SQL into the panel; the editor (URSA-13) calls it. -
Session protocol:
querysays how its result is a graph, andexplain {sql}(URSA-14).query's reply hasgraph, the rulegraph.openwould draw the result by (nodes,edges,path,rings,pattern), read from its columns (ursa_engine::graph::view::rules::rule_of), ornull.explaingives the plan of the last statement, logical then physical, as text, and runs nothing. -
The console's Catalog and Sources panels (URSA-15, URSA-16,
design/console.md§6). The Catalog is a tree of the session's databases, schemas, tables and views (marked by kind) and their columns with types, and a section for property graphs with their vertex and edge tables. It follows the session as it changes, from any tab or agent on it, keeping what was open and the scroll; it has a filter and the ARIA tree's keys. Choosing a table putsSELECT * FROM … LIMIT 100in the editor; a graph,.graph <name>. Sources lists the session's root (ursa serve DIR) with each file's format and size, browses into folders, and browses buckets added by theirs3://,gs://oraz://prefix (kept per server). Choosing a file puts its query in the editor and runs it; a.ursafile can be attached. Errors, such as a bucket's missing credentials, show in the panel. Without thesourcescapability (the browser demo) the panel says so.tests/console-panels.tstests both overursa serve. The console'ssession.onEventnow also reaches the connection being opened, so a panel that listens while the page connects hears its first events. -
The console's SQL editor (URSA-13,
design/console.md§6): CodeMirror 6 in the Editor panel. Its SQL is coloured by the session'shighlight, so it looks exactly as the shell's terminal colours it, in light and dark, and completed by itscomplete: tables, views, columns (aftert.too), graphs, functions, keywords and dot-commands, each with its kind and detail. Ctrl/Cmd+Enter runs the statement at the cursor, or the selection; Shift+Ctrl/Cmd+Enter runs every statement in turn and stops at the first error. The statement running is marked, and the status bar's Cancel stops it. An error shows at its statement: a squiggle under what it names (or where the parser stopped) and the message with the engine's hint. Dot-commands run throughfeed, as the shell's do. The text is kept across a reload, per server port. Tab indents and accepts a completion; Esc then Tab leaves the editor. Other panels put SQL in it withursaConsole.editor.insert(text, {statement, run}). CodeMirror's packages (MIT) are pinned and bundled intovendor/codemirror.mjs, with their licences; the build refuses one that isn't MIT.tests/console-editor.tstests it overursa serve. -
The Ursa Console's page:
ursa serve's link opens it (URSA-12,design/console.md§6). At/console/, with the shell still at/: a sources and catalog column, the editor over the result tabs, and the inspector over History, each panel an empty mount point labelled with the issue that fills it. The columns and panels resize (drag a splitter, or focus it and use the arrow keys), fold, and become drawers under 1024px; skip links, F6 between panels and a visible focus ring keep it keyboard reachable; light and dark come from the shell's tokens. The status bar shows the connection (to the shared session, reconnecting when the server goes, and saying when it was restarted with a new link), the engine's version, the session's root, and the request running with a Cancel button (cancel {target}, throughengine-client.js's newcancel(reply)).bun run buildbuilds it intoweb/dist-console/, never into the deployedweb/dist/;ursa serveserves both (--assetsmay be repeated) and builds both in withserve-embed. The graph pane's styles move fromstyle.cssintograph-pane.css, which the shell links; the shell looks and behaves as before. ursa servein the release binaries, with a database file,--read-onlyand--no-open(URSA-4,design/console.md§5). The release and nightly binaries haveursa servewith its page built in (serve-embed:cli-build.ymlbuilds the page once, withbun scripts/build.ts --no-engine, and every platform embeds it); the crates on crates.io still have no page.ursa serve club.ursaopens the database in every session asursa club.ursadoes, rooted in its directory;ursa serve DIRroots the sessions in DIR (relative paths,.read,ATTACHand writes resolve under it), and with neither the session is in memory, in the current directory: the server no longer changes the process's working directory. It opens its link in the default browser unless--no-open, on port 4280 or the next free one.--read-onlywrites no files, for pairing with an agent:COPY … TO,INSERT INTOa table of files,.output,.once,ATTACHof a database that does not exist, and what changes the database (opened read-only) are refused by the engine (ursa_engine::paths::set_read_only,ursa_shell::session::Options::read_only). The shell's page keepsCOPY … TO 'name'in memory, as in the browser demo; the shared session (the console's) writes it to disk under the root.web/scripts/build.ts --no-enginebuilds the page without the wasm engine. The Linux x86_64 release binary grows from 147.2 MB to 169.6 MB (115 to 132 MB stripped; its archive from 40.9 to 47.0 MB): 18.7 MB for the server, 3.7 MB for the page.
Changed¶
- SQL: an edge with a NULL source or destination is not part of the graph,
on every path (behaviour change, #336). One rule now holds with or
without a vertex table, as DuckPGQ's inner join and #311's vertex keys
have it: such an edge is dropped and counted in
describe'sn_dropped_edges, with the edges to no vertex key, and neither of its ends is a node by it. The index build drops it in one place (ursa_core::EdgeInterner::dropping_nulls, used by every SQL build), andg.nodesleaves out the ends of such edges, so the algorithms,hop,shortest_path, path searches andGRAPH_TABLEthrough the index or as joins all see the same edges and nodes.ursa-sql/tests/null_endpoints.rsruns every path on one graph (integer and string keys, with and without a vertex table), andtests/conformance/sqlpgq/null_endpoints.sltholds the standard's cases. The Python library is unchanged: a NULL endpoint is still an error unlesson_null="drop". What changes, on a graph without a vertex table whose edge table has a NULL endpoint: - The algorithms,
hop,shortest_path,describe,GRAPH_TABLEwith a bound node andGRAPH_TABLEpath searches no longer fail with "graph 'g': an edge has a null source or destination; filter those rows out …". They leave the edge out, anddescribe(g)'sn_dropped_edgescounts it (it was always 0 without a vertex table). g.nodesandGRAPH_TABLE (g MATCH (x) …)no longer list a value that is only the other end of a NULL-ended edge (wrong answer: they listed it as a node, while no edge pattern could reach it and the algorithms refused the graph).hop(g, seeds => [x])from such a value is refused as it is for any value that is no node.GRAPH_TABLEplanned as joins ((a)-[e]->(b),-[e]-) already left the edge out, and a graph with a vertex table already dropped and counted it: their answers do not change. A NULL vertex key is still refused by every path (#411).- Edge ids are built only when a query reads them (#170, part of
#155).
edge_ids, the original row of each CSR slot, is 4 B an edge in each built direction, and only a weight, an edge mask or an edge's row reads it. It is now anursa_core::EdgeIds, which builds itself on first read and keeps what it built: from the identity when the rows are already grouped by source (no source needed, #155), or from the rows' sources read back (RowSource; the SQL engine writes them to an unlinked temporary file inTMPDIR,SpilledRows, 4 B an edge, for an index of 65,536 edges or more). Kernels branch once per call: PageRank, components, BFS/hop, Louvain, label propagation, triangles, closeness, betweenness and degree without a mask or weight read neighbours alone.
The in-adjacency is built without any edge ids: the first in-direction
kernel streams the spilled sources once and reads each row's target off
the out-adjacency, then a stable counting sort by target leaves every
in-segment in row order, as before (transpose_rows). Its own ids are
built the same way when first read. The undirected view (triangles,
clustering) transposes in slot order for its build alone, as only the set
of neighbours matters there: it reads no spill and keeps no in-adjacency.
Storing an index writes the ids without keeping them, and stored files are
unchanged (still version 5).
When the spill cannot be written (no temporary directory, or no room in
it), the index keeps its ids in memory, as before, and the session gets a
notice (could not write the index's edge rows to …; its edge ids are kept
in memory (…)); the query goes on. What a failed write wrote is freed at
once, as the file is unlinked when it is created.
Results are byte-identical: ursa-core/tests/lazy_edge_ids.rs runs every
kernel, plain, weighted and masked, over eager, in-memory and spilled ids
(sorted and unsorted rows, both node orders), checks that no plain kernel
builds them in either direction, and counts the spill's reads: none for
out-direction kernels and the undirected view, one stream for the first
transpose. R-MAT, built as the engine builds it (in-degree relabel), 4
threads, ursa-core/examples/edge_ids_memory.rs, eager → late; resident
memory after the kernel and peak RSS both include the 8 B/edge edge list
the build is given:
| R-MAT 64M | resident after | peak RSS | build + kernel |
|---|---|---|---|
| index only | 569 → 325 MiB | 1108 → 865 MiB | 1.4 → 1.0 s |
| PageRank (20 iterations) | 1165 → 614 MiB | 1254 → 975 MiB | 1.4 + 12.0 → 1.0 + 11.3 s |
| BFS (both directions) | 1174 → 624 MiB | 1177 → 992 MiB | 1.0 + 1.4 → 0.7 + 2.1 s |
| components (weak) | 610 → 369 MiB | 1106 → 863 MiB | 1.1 + 1.0 → 0.8 + 1.0 s |
hop (2, from the hub) |
588 → 344 MiB | 1106 → 863 MiB | 1.1 + 0.22 → 0.8 + 0.23 s |
| Louvain (serial) | 615 → 369 MiB | 1335 → 1096 MiB | 1.1 + 13.9 → 0.8 + 14.2 s |
| weighted PageRank | 1156 → 1185 MiB | 1733 → 1733 MiB | ids and transpose 1.4–1.7 → 2.3–2.7 s |
At 16M edges: index 143 → 82 MiB, PageRank 292 → 155 MiB and BFS 289 →
158 MiB resident; peaks 279 → 219 MiB (index, components, hop), 317 →
248 MiB (PageRank), 297 → 252 MiB (BFS) and 338 → 278 MiB (Louvain). The
build is faster (it writes the sources once instead of scattering the
ids). The transpose alone takes 1.8–2.1 s at 64M streamed against
1.3–1.6 s eager, with a 4 B/edge transient target column; a weighted or
masked query rebuilds the ids once (about 1 s more at 64M, the weighted
iterations themselves unchanged), and in-ids read late take 1.8–2.1 s.
-
ursa serve: the page holds its WebSocket in a worker, and a large part is not copied on the page (URSA-7).web/public/socket-transport.jsopens the socket insocket-worker.js, which assembles each reply and posts it to the page with its parts' buffers transferred, as the wasm engine's worker does. A part is no longer copied out of its frame (data.slice(8)): it is the frame's buffer atoffset8, whichengine-client.js's header now allows a part to carry..graph rmat's 8.4 MB of UGR took 100 to 120 ms of the page's thread in long tasks before the reply was complete; it now takes none. Its first frame is where the worker's is, within noise: medians of 24 runs each, at a load average of 3 to 19 on 4 cores, 1,592 ms over the worker and 1,625 ms over the socket (1,609 ms before this change).web/tests/graph-timing.tsruns againstursa servewithURSA_SERVE_TOKEN, and stops at the first frame withFIRST_ONLY=1. -
SQL: an index of 65,536 edges or more numbers its nodes by in-degree (behaviour change:
louvainandlabel_propagationcommunities, the last bits of floats and the order of unordered rows, #172). Dense node ids were first-seen order, which for anonymised ids sorted by source (the Bluesky export) carries no locality: every rank a pull PageRank reads is close to a random access. The build now numbers the nodes by in-degree, highest first, ties in first-seen order, and renumbers the id map with them (ursa_core::NodeOrder,Topology::build_ordered). The relabel is fused into the counting sort: its first pass counts the in-degrees too (from 4,194,304 edges, on one block of rows in eight: the order is a heuristic for the hubs), a counting sort orders the nodes, and one streaming pass renames the targets. Each node keeps its first-seen id (Topology::original_ids, stored with the index), and what must not depend on the numbering is defined on it: component labels (below), the sampled sources ofbetweenness,avg_path_lengthanddiameter, the ties of a weighted shortest path, and the layouts. Per-node rows still come out in first-seen order, and label propagation's labels are first-seen ids. Partitions of components, counts, distances, reached sets and user ids do not change;ursa-core/tests/relabel.rsandursa-engine/tests/locality.rscheck every kernel against a first-seen build. A smaller graph keeps its first-seen numbering (its arrays fit in cache in any order), and the Python library does not relabel.
Behaviour change: louvain and label_propagation visit the nodes,
break ties and (Louvain) aggregate in node order, so on a relabelled index
a seed gives other communities than before, of the same quality. They are
still the same for a seed on any thread count (pinned in
tests/louvain_pinned.rs and tests/determinism_threads.rs). They run on
the relabelled graph itself: renumbering it back for them would cost 8
bytes an edge (Louvain) or 16 (label propagation) on every call, about 19
and 39 GB on the full 2.4B-edge Bluesky graph. Seed 1, community count
and modularity, first-seen → in-degree:
| graph | louvain |
louvain(parallel) |
label_propagation |
|---|---|---|---|
| R-MAT 16M | 223, 0.0682 → 222, 0.0683 | 222, 0.0680 → 223, 0.0677 | 205 → 201 |
| R-MAT 64M | 843, 0.0622 → 839, 0.0624 | 842, 0.0619 → 840, 0.0617 | 827 → 817 |
| sorted 64M | 839, 0.0624 → 841, 0.0624 | 840, 0.0617 → 839, 0.0621 | 836 → 817 |
(Label propagation finds no structure in R-MAT: modularity 0.00003 in
either order.) Serial Louvain is 9–15% faster on the relabelled 64M-edge
graphs. benchmarks/bluesky_cloud/run.py's check_louvain_ge now
accepts 3,624 communities ±5%, until the next round re-records it.
Measured with ursa-core/examples/locality_order.rs on a 4-core Xeon
(504 MB L3) shared with other builds, best of 3, CPU seconds. On R-MAT
64M edges with anonymised ids sorted by source ("sorted"), one thread:
PageRank 0.30 → 0.19 s per iteration (-37%), BFS 0.32 → 0.26 s, weak
components 0.44 → 0.37 s. On plain R-MAT, whose first-seen order already
puts the hubs first, nothing measurable moves (16M and 64M edges:
PageRank, weak and strong components, hop, BFS, triangles and closeness
within the run-to-run noise). The relabel adds to a 64M-edge build
(after #544, median of 5): R-MAT 0.79 → 0.92 s (+15%), sorted 0.35 → 0.45
s (+27%; its first-seen build scatters in order, which no relabel can);
peak memory +41 MB (the node order). Breadth-first and reverse
Cuthill–McKee orders were measured too: no faster than in-degree, and 5 to
8 times its build cost. An index stored by 0.12 (format version 4) is read
with its numbering kept; a relabelled one is stored as version 5, with its
original ids.
- Component labels are canonical (behaviour change, #150).
connected_components labelled a component by its union-find root (weak)
or Tarjan root (strong), which depend on the order the work is done in. A
component's label is now the first-seen id of its first node to appear
(its smallest dense id when nothing is relabelled): the same for the
serial and parallel kernels, and unchanged by the relabel above. The
partition is the same. Python's ur.connected_components gives the same
labels.
-
The web shell talks to its engine through the session protocol (#536,
design/console.md§4). The per-operation glue ofursa-wasm'sWebShell(output capture, UGR encoding, inspect's JSON, uploads, export) isursa_shell::session::Session, with every operation behindSession::handle(op, args, parts);WebShellis wasm-bindgen glue over it, with one method,handle. The page calls the engine throughweb/public/engine-client.js(connect(WorkerTransport)), and the operations take their protocol names (graph.open,graph.explore,cancelInput,highlightAnsi, …). Nothing a user sees changes. -
The session protocol is version 1 (URSA-2), with the spike's changes to
design/console.md§4. The first request must behello, withprotocol: 1andsession: "new" | "shared"; the session refuses any other request before it and any other version, with kindprotocol. The session gainscancel,memory({bytes, kind: "wasm" | "rss"}, which the worker answered itself before) and the console'squery(typed columns, the schema's metadata such asursa.pattern, and the first rows as an Arrow IPC part).ursa_shell::session::OPSlists the operations; the new reference page,docs/reference/protocol.md, is generated from it and tested against it. -
The session keeps results, by id (URSA-9).
querygives its result an id ("r4") and keeps it:fetch {result, offset, rows}pages through it as Arrow IPC,export {result}writes it,graph.open {result}draws it, andclose {result}drops it, so the console can keep several results open. A session keeps its last 16 results within 256 MB, the oldest dropped first; a result over 256 MB on its own keeps only its first rows. A result that has gone, or rows past those kept, fail withnot_foundand a message to run the query again. The shell's last result (.graph,.export) is unchanged. -
The graph pane is a module any page can embed (URSA-8,
design/console.md§3).web/public/graph-pane.js'screatePane({container, engine, commands, status})makes the Graph view's pane: its markup, the/search and.find, the not-shown counts, Esc, the theme, and the graph commands (.graph,.find,.expand,.collapse,.hide,.show,.undo,.redo), run through the engine client. What the view asks to run (a double-click's.expand 33, the inspector's and the search's buttons) goes to the host'scommandssink: the web shell's is its terminal, as before, and the console's will be its History panel.app.jsloses about 250 lines of graph glue; the graph view behaves as before. A second host,web/tests/pane-host/(never deployed), proves it in the e2e test. -
The session sends events, and the console's catalog, sources, completion and highlight operations (URSA-13, URSA-15, URSA-16, the protocol's part;
design/console.md§4).cataloglists the session's databases, schemas, tables (table,vieworexternal) with their columns, and its property graphs with their vertex and edge tables. After any request that changes it (CREATE,DROP,ATTACH,CREATE PROPERTY GRAPH,.open, a dataset load), the session sends{"event": "catalog"}, found by comparing a fingerprint of the catalog before and after:ursa servesends it to every connection on the session, the browser demo's worker posts it, both before the request's reply, andengine-client.js'son("catalog", fn)hears it.sources.list {url}lists a directory under the session's root (symbolic links resolved, a path outside refused, hidden files left out) or a bucket prefix (s3://,gs://,az://, throughobject_store'slist_with_delimiterand the CLI's credential chain), with each entry's format and size, never a credential;sources.attach {url, as}isATTACH. Both need capabilitysources, which a session with a directory root reports inhello.complete {sql, cursor}offers tables, columns (qualified aftert., an alias's too), functions, graphs, keywords and dot-commands, without running a query;highlight {sql}gives the shell's colouring as spans. Their offsets are UTF-16 code units, as JavaScript's. The protocol document gains an Events section, generated fromursa_shell::session::EVENTS. -
A root per session, and
COPY … TOto disk under it (URSA-6,design/console.md§5). Relative paths resolve against the session's root (ursa_engine::paths::Root), which travels with the session's config, in place of a base URL global to the process: a directory natively, a URL in the browser. Two sessions in one process each read their own files. A session with no root is the CLI's: relative to the working directory, as before. The root coversFROM 'x.csv',read_*(),CREATE EXTERNAL TABLE … LOCATION,COPY … TO,ATTACH(and.open),.read,.outputand.once. A session with a directory root reads anything (an absolute path,~/…or a URL reads what it names), but writes only under the root: aCOPY … TO,.outputor.oncetarget must be a relative path with no.., and no symbolic link in it may lead out; anINSERT INTOa table of files must be into files under the root.ursa_shell::session::Optionsgainsrootandcopy_to_disk: a native session can keepmemory://uploadsfor the files a page adds and write its copies to disk, asursa servewill. The browser demo is unchanged:WebShell.setBaseUrlsets the page's root, which each session takes when it is made. -
Default (serial) Louvain is about a third faster, with the same communities (#268). Local moving, the serial core of
louvain(g), took 70% of a run. Each node visit sorted every neighbouring community by id before scanning them for the best move; it now keeps only the communities whose gain beats staying (usually none, or one or two) and sorts those. The others could never be chosen, so the choice is the same. Local moving also prefetches the next node's adjacency, each neighbour's community and its accumulator entry a few slots ahead, and each community's total. The visit order, the tie rule and the order of every floating-point sum are unchanged: labels are the same bit for bit, for every seed, on any thread count. A new test,tests/louvain_pinned.rs, pins them with golden hashes recorded before the change (karate, R-MAT, isolated nodes, weighted and masked graphs, serial andparallel => true) on 1, 2, 4 and 8 threads and withoutrayon. R-MAT,seed => 1, 4 shared cores, best of 3 interleaved runs:
| edges | before | after | peak RSS |
|---|---|---|---|
| 16M (2^20 slots) | 6.44 s, 5.14 CPU-s | 4.72 s, 3.77 CPU-s | 480 → 476 MB |
| 64M (2^22 slots) | 43.1 s, 32.5 CPU-s | 27.4 s, 21.1 CPU-s | 1,909 → 1,897 MB |
At 64M edges, local moving went from 21.7 to 11.6 CPU-s (70% of the run
to 50%). It stays serial, as its result depends on the visit order; the
graph build (now a third of the run) and the aggregation (a sixth) were
already parallel. examples/rmat_kernel.rs gains
--kernel louvain.
- Benchmarks: memory is the process's footprint, with peak RSS beside it
(#533). benchmarks/bluesky_cloud/run.py recorded each step's peak
memory as ru_maxrss, which since #382 counts the pages of the
memory-mapped stored index a step reads, so round 5 (#388) flagged
PageRank and the components as memory regressions when they use less. The
main figure (peak_footprint_bytes, the Memory column of
summary.md) is now the process's own memory without those clean file
pages: on macOS the lifetime peak phys_footprint (proc_pid_rusage,
RUSAGE_INFO_V4, read before the child is reaped), on Linux the peak of
RssAnon + RssShmem sampled from /proc/<pid>/status every 20 ms.
peak_rss_bytes stays as a second column, and meta.memory_measure
says how the footprint was taken. benchmarks/sql_scale records both the
same way (peak_mem_mb, peak_rss_mb), and its --mem-limit-gb applies
to the footprint. Still standard library only.
- The graph view's inspector shows an edge's row in 20 to 40 ms on a
million edges, not 90 to 160 (#489). An edge's rows were found by a
scan of the edge table for its two ends. They are now found through the
graph's index (
induced_edgesof the two ends gives their row numbers) and read by number: from a Parquet file with a row selection, which skips the pages before the row, with the bytes read kept for the session (ursa_engine::graph::view::rows, 64 MiB at most); from any other table by passing over the rows before. A table of the two key columns alone, such as rmat's, is not read at all, and the drawing's row number picks one of parallel edges among the rows found. The rows are the ones the query by the two ends gives, in the same order, and the scan remains for what the index cannot say: a graph of several edge tables, or a table read as several partitions.WebShell.inspectEdge's JSON saysindexed. On rmat in headless Chromium (medians of four sessions of 5 to 7 runs, under a load of 2 to 7 on 4 cores) an edge's row comes 21 to 41 ms after the click, 13 to 31 ms of it in the engine; the first click of a page takes 54 to 83 ms, of which the engine's part is 17 to 41 ms and the rest the page's first panel. Where the row is read (a view of rmat with a third column) it is 31 to 43 ms, and 77 to 112 ms on the first click, which fetches the file's column chunks (seeweb/tests/inspector-timing.ts).inspecttakes aRunSql. - The graph view keeps clear of its inspector (#493). The inspector's
panel is drawn over the web shell's Graph view, and the nodes under it
could not be clicked, double-clicked or expanded. Now the camera makes
room: 450 ms after a selection opens the panel (once a second click or
tap would no longer be a double one), what was in sight moves into the
part of the view the panel leaves clear, over 200 ms, or in one step
under
prefers-reduced-motion. Closing the panel puts the view back. While the panel is open,0,fand a double-click on empty space fit into the clear part, and a camera that follows the layout follows it there. The panel opens at once after a tap too (it waited 350 ms): on a phone, where it is a sheet across the bottom, it opens across the top when the node tapped is drawn low, as it opens on the left on a desktop when the node is on the right. The sheet is at most 45% of the view's height (it was 55%).ursa-viz:GraphView.setFitInset(left, top, right, bottom)keeps part of the canvas clear when the camera fits, andfollowing()says whether the camera follows the layout. - SQL: graph function parameters and columns renamed, one name per role
(breaking, #415). The old names are not accepted. Each one gets a "did
you mean" with its new name, and so do
k,max_hopsanddepth: hop(n =>)ishop(steps =>), as inrandom_walk.random_walk(start =>)israndom_walk(seeds =>), as inhop.random_walk(seed =>)israndom_walk(random_seed =>).- The
nodecolumn ofrandom_walkisid, soUSING (id)joins it. - The
hopcolumn ofshortest_pathisstep, as inrandom_walk.
shortest_path keeps source and target. A "did you mean" now names
only a parameter that can take the value given:
random_walk(seed => [0]) points to seeds, and seed => 7 to
random_seed. The Python library's names are unchanged.
- SQL: a literal node id that is not in the graph is an error (breaking,
#416). hop(g, seeds => [99]), shortest_path(g, source => 0, target =>
99) and random_walk(g, seeds => [99], …) returned no rows, which looked
the same as no path. They now fail and name the id: hop(seeds =>): 99 is
not a node of graph 'pg'. For a list, the error names up to three
missing ids and gives the count: 5 ids are not nodes of graph 'karate':
95, 96, 97 and 2 more. Ids from a subquery (seeds => (SELECT …)) are
still skipped when they name no node. A notice on stderr says how many
were skipped. To probe for a node, use a subquery or g.nodes.
induced_edges still skips ids that are not nodes. shortest_path with
source equal to target still returns no rows, since a path of no
edges has no edge rows. Its reference entry now says so.
- SQL: graph functions accept more argument forms (#415). direction
values are read in any case ('BOTH', 'Out'). 'undirected' is
refused with a hint to use 'both'. pagerank and betweenness take
direction => 'in', which runs the same kernel on the reversed graph
(SQL only: the Python verbs still take 'out' and 'both').
connected_components(g, direction => …) says to use mode => 'weak'
or 'strong'. Named arguments may be written name = value or
name := value as well as name => value, as in read_csv, also inside
algorithms(…). The reference entry for diameter now says that its
default (approximate => true) is a lower bound, and that
approximate => false gives the exact value.
- An empty .parquet file is an error naming it (behaviour change: an
empty Parquet file used to read as zero rows). DataFusion's listing
skipped a 0-byte file before the footer check (#332) saw it, so
FROM 'empty.parquet' returned no rows, and a glob or directory holding
one read as if it were not there. Ursa now lists a Parquet table's files
itself and stops at an empty one, as DuckDB and PyArrow do: cannot read
'empty.parquet': it is not a valid Parquet file: the file is empty. It
covers a file named directly and one found by a glob or a directory, in FROM '…', read_parquet, CREATE EXTERNAL TABLE … STORED
AS PARQUET, graphs over them and the Python scans, which name the file
for a glob (scan_edges('data/*.parquet'): 'data/b.parquet' is not valid
Parquet (…)). An empty CSV or JSON file is still skipped. A table is
checked when it is created: an external table whose file becomes empty
later reads it as no rows.
- hop's rows come back in no particular order (behaviour change,
#452). SQL hop(…) and Python ur.hop(…).from_(…) return the same rows
as before, with the same distances, but not always in the same order: the
nodes found at one distance from a seed may come back in another order,
and the order can differ from one run to another (for example once the
graph's in-adjacency has been built or read). Each seed's rows still come
together, seeds in the order given, nearer nodes first, and the order does
not depend on the number of threads. Add ORDER BY (in Python, .sort)
where the order matters. hop's reference entry says so.
- Breadth-first searches switch direction on large levels: hop,
diameter, avg_path_length and bfs_distances use 3 to 11 times less
CPU on large graphs, with the same results (#452). A level whose edges are a large
share of the edges not yet read is now expanded bottom-up: each node not
yet reached reads its edges the other way and stops at the first that
leads to the level (direction-optimizing BFS, Beamer, Asanović and
Patterson, 2012). A search from one source splits such a level across
threads. Distances, reached sets, diameter and avg_path_length are
unchanged: a new test pins hashes recorded before the change (karate, two
R-MAT graphs, a disconnected graph, a sparse directed graph, a path; every
direction, masked and not; several seed sets and depths; hop's rows
compared sorted), on one thread and four, and without rayon. Only the
order of hop's rows changes (above). In direction out a search goes
bottom-up only when the in-adjacency is already built or stored; it never
builds one for this. shortest_path keeps the top-down search, because
which shortest path it returns depends on the order. On R-MAT graphs
(shared 4-core machine, best of two runs, CPU-seconds):
| graph | query | before | now |
|---|---|---|---|
| 64M edges, 4M nodes | full BFS from 3 sources, 1 thread | 2.30 s | 0.44 s |
| 64M edges, 4M nodes | hop, n = 3, from the hub |
1.03 s | 0.14 s |
| 64M edges, 4M nodes | hop, n = 3, both, 16 seeds |
28.8 s | 3.8 s |
| 64M edges, 1M nodes | full BFS from 3 sources, 1 thread | 1.14 s | 0.10 s |
| 64M edges, 1M nodes | hop, n = 2, from the hub |
0.34 s | 0.03 s |
| 16M edges, 1M nodes | avg_path_length, 64 sources |
4.07 s | 1.06 s |
A hop from many seeds that are not hubs gains less (16 seeds, n = 2:
1.3–2.6×), as most of its time goes to the rows. Peak memory is the same
within 1% (avg_path_length and diameter hold 1 byte per node per
thread instead of 4).
-
A Parquet file's schema metadata is kept when Ursa reads it. Ursa's sessions set
datafusion.execution.parquet.skip_metadata = false, so theursa.*column roles (#431) of a result written to Parquet come back with it when the file is read, as they do from an Arrow file, and.graphdraws the file as it drew the result. DataFusion's default drops every Parquet file's metadata;SET datafusion.execution.parquet.skip_metadata = truerestores that. -
Graph function parameters are range-checked (behaviour change, #416). A number with no meaning for its parameter was accepted and gave a plausible-looking result:
pagerank(g, damping => -1)returned a negative PageRank,max_iter => 0the uniform start vector,betweenness(g, sample => 2)exact values andsample => -1wrong ones,louvain(g, resolution => -1)one community. Each is now an error that names the parameter, its range and the value:pagerank(damping =>) must be between 0 and 1; got -1. The ranges:dampingbetween 0 and 1;max_iter(pagerank,label_propagation) at least 1;tolat least 0 (tol => 0still runs every iteration);sample(betweenness,avg_path_length) above 0 and at most 1;resolutionabove 0; and for the layoutskandjitter_toleranceabove 0,gravityandthetaat least 0. Every value inside its range computes what it did. The ranges are declared once, in the function catalog, soursa_functions()has them (arangefield in each parameter, NULL where any value is accepted),.functions NAMEand the function reference show them, and the Python verbs that take these parameters (ur.pagerank,ur.betweenness,ur.label_propagation,ur.louvain) raise the same error, wordedpagerank(damping=) must be between 0 and 1; got -1. Python'sur.avg_path_length(sample=)is unchanged. - SQL: a vertex table's key must identify one row (behaviour change,
#411). A vertex table with a duplicate or a NULL key is refused, with one
message, by everything that reads it as a graph's nodes: the algorithms,
statistics and traversals,
g.nodes, andGRAPH_TABLE(graph 'gs': vertex table 'v' has 1 row with a duplicate key (id = 1) and 1 row with a NULL key; a vertex table's KEY must identify one row. Deduplicate it in a view …). SQL/PGQ requires a unique, non-null key, and DuckPGQ takes it from a primary key. Before, the graph was accepted and the three disagreed: the algorithms counted a duplicated key once and skipped a NULL key, whileg.nodesandGRAPH_TABLEreturned every row, so one node was two matches andg.nodes JOIN degree(g)repeated it; onlyneighbors_agg(attribute =>)noticed, with a message aboutvalues =>.CREATE PROPERTY GRAPHstill accepts the table (it is read when a query runs); queries over it now fail until it is deduplicated, for example in a view withSELECT DISTINCT ON (key) *. An index build counts the rows as it numbers the keys;g.nodesand aGRAPH_TABLEnode count the key column when the query runs (EXPLAINreads nothing), once per version of a table's files: the count is kept for the session and, with a database, recorded beside its stored indexes (indexes/vertex_keys.json), and a stored index built from the same keys stands for it, so a later process, read-only included, reads only the files' metadata. A changed file is counted again; a table that does not read only files is counted by each query. Stored indexes of graphs with a vertex table are built again once, under a new key, so none built before the check is reused. Not covered: the keys of an edge table between two vertex tables are checked where a pattern reads those tables' rows, not in its index. - SQL:
GRAPH_TABLErefuses a node label that contradicts its edge (behaviour change, #410). An edge matches only between the vertex tables its edge tableREFERENCES.(a:Person)-[k:knows]->(b:School), whereknowsgoes from students to students, joinedknow.dsttoSchool.school_idon values that happened to be equal and returned rows for edges that are not in the graph. It is now an error that names the edge table, its vertex tables and the pattern as written. The standard gives such a pattern no rows; Ursa refuses it, as DuckPGQ does, since it is almost always a mistake, and an empty result would hide it. - SQL:
GRAPH_TABLErefuses text left over after aWHEREcondition or aCOLUMNSitem (behaviour change, #409).WHERE a.id = 0 b.id = 3ran asWHERE a.id = 0, andCOLUMNS (a.id AS a nonsense, b.id AS b)returned one column: the SQL parser stopped at the first token it could not use and the rest was dropped. Both are now syntax errors that name the token and its position in the pattern, for the pattern'sWHERE, a node's or edge'sWHERE, andCOLUMNS.KEEP …andONE ROW PER …, which were ignored the same way, are refused as not supported yet. Only queries that were already wrong are affected. - SQL: more of SQL/PGQ's and DuckPGQ's
GRAPH_TABLEforms run (#413, #414). Each was an error before, so no query that ran changes. COLUMNSmay be left out, or writtenCOLUMNS (*): every property of each named node and edge, in pattern order (a.*, k.*, b.*), as DuckPGQ returns them. A repeated name gets a suffix (id,id:1).<-[e]->and<->, the standard's "left or right", mean-[e]-and-, since every edge of an Ursa graph is directed. The undirected~forms are refused: "Ursa's edges are directed; use -[e]- to follow them either way".element_id(a)of a node is its key;element_id(e)of an edge is its row in the edge table, the numberedges(p)lists (for the edge of a path with a variable; an edge read by a join is refused for now).- Graph predicates in
WHEREandCOLUMNS:SAME(a, b, …),ALL_DIFFERENT(a, b, …),x IS [NOT] LABELED l, anda IS [NOT] SOURCE OF e/IS [NOT] DESTINATION OF e. KEEP <selector or path mode>after a pattern of one path is its prefix form:MATCH p = (a)-[e]->*(b) KEEP ANY SHORTESTisMATCH p = ANY SHORTEST (a)-[e]->*(b).ONE ROW PER MATCH, the default, is accepted.CREATE PROPERTY GRAPH:REFERENCES twithout a column list namest's key, when it is known (itsKEY, its primary key, or anotherREFERENCES).- Clearer errors for what is not supported yet, in place of parser
errors, debug dumps or a wrong variable:
KEEPover several paths,ONE ROW PER VERTEX/STEP, aggregates inCOLUMNS, a subquery in the pattern that reads a table the statement does not name,LATERAL GRAPH_TABLEand other references to tables outside theGRAPH_TABLE, the properties of a quantified edge variable ("stands for several edges"), and Cypher's property maps ({name: 'x'}) and ranges (*1..3), each with the SQL/PGQ to write. The label-expression error now points at #412. - A SQL/PGQ and DuckPGQ conformance suite (#299),
tests/conformance/, in sqllogictest's format, with a reviewed list of known differences;cargo test -p ursa-sql --test conformanceruns it. - SQL: a
GRAPH_TABLEvariable can be a row of several element tables (#412). Each form was an error before, so no query that ran changes, except one that returned wrong rows (below). - A variable without a label is any table of its kind that its edges'
REFERENCESallow: on DuckPGQ'spg,MATCH (a)is every student and school, and(a:Person)-[e]->(b)follows bothknowandstudyAt. - A label on several vertex or edge tables (LDBC's
MessageonPostandComment) matches all of them. - Label disjunctions,
(a:Person|School), and%, any label;x IS LABELED a|btoo.&,!and parentheses are still refused, with a message. - The pattern is planned once per combination of tables, and the plans
are combined with
UNION ALL; combinations the edges rule out are left out. When every variable has one table, the plan is the same as before. More than 64 combinations is refused with a request for labels. - A property of a variable over several tables reads as NULL in the rows
of the tables that lack it, as in SQL/PGQ and GQL:
MATCH (a) COLUMNS (a.name)gives the students' names and NULL for the schools. A property no table has is an error that names the tables (so a typo is caught), and so are tables that have it with types that do not mix (numbers mix with numbers, text with text).a.*andCOLUMNS (*)return only the properties every table has; name the others to get them.element_id(a),SAMEandIS LABELEDwork per table. - A quantified edge, or the edge of a searched path, that can be a row of several edge tables is refused: label it.
-
Fixed: an undirected edge between two different vertex tables,
(a:Person)-[s:studyAt]-(b:School), also joined the reverse orientation on key values that happened to be equal, and returned rows for edges that are not in the graph. It now follows the one way its edge table goes. -
Triangle counting uses about a third of the CPU, with the same counts (#420).
triangle_count, and soclustering_coefficientand the SQL functions over them, was the slowest step on the full Bluesky graph (1,828 s on 16 cores). The kernel still orients each edge toward its higher-ranked end, by(degree, id), and finds each triangle once. Now the nodes are numbered by rank and each list holds ranks, so for an edgeu → vonly the entries ofu's list aftervare read; a list of 32 entries or more is marked once in a per-thread position table and the lists it meets are looked up there; of two lists, one 8 times the other's length is searched, not merged; and each node's credits are added once per list entry, not once per triangle, so threads no longer write the hubs' counters all the time. Per-node counts are bit for bit the old kernel's: a new test pins them on ten graphs (hubs, a clique with leaves, R-MAT, self-loops, parallel and reciprocal edges, vertices with no edge, masks), recorded before the change, and the old kernel is kept in the tests as a reference. On R-MAT graphs on a shared 4-core machine: 16M edges (384M triangles) 35.3 to 12.6 CPU-s, 64M edges (6.19B triangles) 376 to 120 CPU-s. Nodes of degree under 2 get no rank, so the pass costs the same among 16M vertices with no edge (38.0 to 13.9 CPU-s). It adds 4 bytes per node of degree 2 or more, plus up to as much again per thread for the position tables. - Betweenness with a small sample holds half the scratch memory (#454).
With fewer than 64 sources per thread, the kernel ran
2 × threadssources at a time, each with its own state of 24 bytes per node (more when weighted), all kept for the whole run: about 30 GB at Bluesky's size on 16 threads. It now runsthreadsat a time, which keeps every thread as busy. Results are bit for bit the same (each node's sum is taken in source order whatever the window; the reference-kernel and thread-count tests cover it). On a 32M-edge, 2.1M-node R-MAT graph with 105 sources on 4 threads: peak RSS 1,019 MB to 814 MB (the graph alone is 576 MB), time unchanged (61 s and 60 s, within the noise of a shared machine). - Unweighted closeness uses a sixth of the CPU or less, with the same
results (#422).
closenessran one breadth-first search per node. It now runs 64 sources per pass, one bit of a 64-bit word per source (multi-source BFS, Then et al., VLDB 2014), so a node's adjacency list is read once per level on which any of the 64 searches reaches it, not once per search. Each source's distance sum and reach count are the same integers as before, so every score is the samef64, bit for bit, in every direction and under an edge mask: a new test pins golden hashes recorded before the change (karate, R-MAT, a disconnected graph with isolated nodes, a sparse directed graph, a long path; masked and not) and compares with a per-source search, and the thread-count test now covers unweighted closeness. Weighted closeness (Dijkstra) is unchanged. On R-MAT graphs of 65,536 nodes on a shared 4-core machine (best of two runs):
| graph | before | now |
|---|---|---|
1M edges, out |
38.3 s, 119 CPU-s | 6.4 s, 19.8 CPU-s |
1M edges, in |
62.8 s, 123 CPU-s | 14.0 s, 20.5 CPU-s |
1M edges, both |
87.5 s, 309 CPU-s | 13.0 s, 34.9 CPU-s |
2M edges, out |
92.6 s, 213 CPU-s | 15.9 s, 29.5 CPU-s |
Each thread holds 16 bytes per node (was 4), plus its frontier list.
- Unweighted Louvain holds about half the memory, with the same
communities (#450). An unweighted run's level-0 working graph stored an
8-byte f64 per adjacency slot for a weight that counts parallel edges
(1, or 2 for a reciprocal pair). It now stores that count in one byte, 5
bytes a slot instead of 12; a graph with more than 255 parallel edges
between two nodes, a weighted run, and every aggregated level keep f64s.
Local moving (serial and parallel => true) and the aggregation read
either store through the same code, compiled once for each. Results are
unchanged, bit for bit. On R-MAT graphs (4 shared cores), Louvain's peak
heap went from 488 to 227 MB at 20M edges and from 1,295 to 630 MB at 50M
(peak RSS 1.72 → 1.11 GB), serial or parallel, at the same speed or
slightly faster; weighted runs are unchanged.
- SQL: a stored graph index is memory-mapped, not read whole (#382).
Loading one read the whole file on one core, so at full scale (2.42B
edges, an 18.6 GiB index) every query in a new process paid 15 s, even a
hop that touches a few thousand edges. Now the index file is mapped
(Linux, macOS): a traversal or path search reads only the adjacency lists
it visits, and an algorithm over the whole graph reads the file at the file
cache's speed, on all cores. On a 250M-edge graph (a 1.9 GiB index), a
1-step hop in a new process takes 0.16 s (was 6.6 s) and 0.2 GB of
memory (was 2.4 GB); degree 0.33 s (was 6.7 s); PageRank 2.8 s (was
18 s). Results and node numbering are unchanged. On Windows, which cannot
replace a mapped file, the index is read whole as before, but on all
cores.
- Index file format version 3. The layout is version 2's (raw
little-endian arrays at 64-byte-aligned offsets); each section now has
its own CRC-32 in the section table, and the trailer's CRC covers the
header, key and table. Loading checks those and the per-node sections
(offsets, node ids) at once; the edge arrays' CRCs are checked, in
parallel, before a whole-graph algorithm runs, and a mismatch drops the
stored index and builds it again, with a notice. A traversal relies on the
checked offsets and the kernels' bounds checks instead.
- Indexes stored by 0.10 keep loading (read whole and checked, as
before), and the first writer to load one rewrites it as version 3, with
a notice (rewriting the stored index for g in club.ursa (…) in the
current format: …). Version 1 files are still built again.
- A stored index is still never changed in place (a new one is renamed
over it, an eviction removes it, a chunk is only appended), so a process
keeps reading the index it mapped while another process replaces it.
Mapped pages count in a process's RSS once read, as shared, reclaimable
file cache.
- SQL: a new process no longer hashes every node id of a stored index
before its first query (#421). Loading a stored index rebuilt the
id-to-node hash table from the stored ids, one id at a time on one core:
0.4 s for 2M string ids, 5.5 s for 20M, in every new process, even for a
hop from one seed, which undid most of the gain of mapping the file
(#382). Now the table is stored in the index file and used as it lies
there, and the id column is borrowed from the mapped file instead of
copied to the heap. On a graph of 20M nodes with 32-byte string ids and
30M edges (4 shared cores), in a new process each time: a 1-step hop
from one seed takes 0.29 s (was 7.0 s) and 1.06 GB at peak (was 1.80 GB);
count(*) FROM degree(g) 0.57 s (was 6.95 s); PageRank 22.6 s (was
32.5 s) and 3.21 GB (was 3.95 GB). What a load still reads is the
per-node sections, to check their CRCs and that the ids are UTF-8, on all
cores. Results and node numbering are unchanged.
- Index file format version 4: version 3 plus one section, the ids'
lookup table (an open-addressing table of u32 node indexes, 6 bytes a
node; its layout and hashes are fixed and documented in
ursa_core::id_map). The file of the graph above grows from 1.52 GB to
1.64 GB, and building and storing its index takes as long as before.
- Indexes stored by 0.11 (version 3) and 0.10 (version 2) keep
loading. They have no table, so one is built in memory, but only when
a query first looks a node up by its id (seeds, sources, a join on ids):
an algorithm over the whole graph never builds it, and a hop on the
version 3 file of the graph above takes 2.1 s. The first writer to load
such a file rewrites it as version 4, with the notice rewriting the
stored index for g in club.ursa (…) in the current format: ….
- ursa_core::IdMap::from_stored_ids and IdMap::lookup_table are the
two halves of this; IdMap::from_user_ids still interns eagerly.
- SQL: GRAPH_TABLE path searches are about twice as fast from one start
node, and run in parallel from several, with the same rows (#451). The
search copied each node's adjacency list (two lists, merged into a third,
for an undirected edge) before reading it, and looked up and counted a
per-edge state, through a match on how the states were stored, before
the cheap test that rejects most edges. Now it reads the lists where they
lie (an undirected step merges the two as it reads them), tests first, and
is compiled once per kind of state table, with the loop's branches decided
per search. ANY SHORTEST keeps one bit per state instead of 8 bytes, so
its table is dense at any size; the other tables stay dense up to 16 bytes
a node of the graph (or 512 MiB) instead of a fixed 2^26 states, and the
map past that, the target slots and the per-target counts use FxHash
instead of SipHash. Each query no longer copies the index's whole id column
to build its result (concat of the starts and every node's id): a
point query on a stored index reads only the ids of the nodes its paths
pass. From several start nodes, the searches run on all cores, one walker
per thread, each with its own state table (at most 1 GiB of them
together), and their rows are appended in start order; when
ursa.max_paths stops the query, and with which error, is what searching
one start after another gives (each start is checked against the exact
count of the paths before it). Rows, their order and the expanded
metric are bit for bit as before: a new test pins every row of a matrix
of searches (directions, selectors, modes, bounds, start sets, targets,
limits, four graphs), recorded before the change, on one thread and on
four, and another the rows of SQL path queries from a built and a stored
index. On R-MAT graphs with a stored index, in a new process each time
(wall, shared 4-core machine): from node 0, ANY SHORTEST ->{1,3}
0.88 → 0.44 s at 32M edges, ANY SHORTEST ->* 0.87 → 0.39 s (with
vertices(p) 0.98 → 0.55 s), undirected {1,2} 1.22 → 0.62 s; one pair
0.10 → 0.03 s with 30-byte string ids; from 16 start nodes, {1,3}, 16.4M
paths, 12.7 → 2.2 s (12.7 → 5.5 CPU-s); 64 starts that reach the limit
fail after 7.6 → 1.1 s. Peak memory is about the same.
- SQL: an index build interns a vertex table's keys while it interns the
edges, not before them (#385, N49). With the edge scan parallel (#351),
reading the keys first was the serial part of a build with a vertex table:
a .csv.gz decompresses on one core, and the edges waited for it. Now the
keys and the edges are read and interned at once, on threads of their
own: the edges with a provisional numbering, until the last key is in;
then those are renumbered into the keys' numbering (one lookup per
distinct endpoint, then in place, in parallel) and the rest go straight
into it. The node numbering, the edges kept and the stored index are byte
for byte the ones interning the keys first gives, wherever the switch
falls; a test checks it with the keys in CSV, gzipped CSV and Parquet. On
4 cores, 96M edges behind a filter over 160M rows of zstd Parquet and a
40M-key vertex table: 19.8 s → 18.6 s with the keys in a 1.1 GiB
.csv.gz of three columns (its single-core decompression, about 14 s, is
now most of the build); a small .csv.gz or Parquet of the keys is as
before, within noise. The browser still reads the keys first.
- SQL: the build's read-ahead is a setting, scaled and capped
(#385, N45). The partitions an index build decodes ahead of the one it is
interning held up to a fixed 1 GiB, which raised a build's peak memory by
about 0.7 GB. It is now ursa.build_read_ahead: auto by default, 256 MiB
per partition of the source (so 1 GiB from 4 partitions up, as before), at
most an eighth of the memory available to the process (MemAvailable, or
the cgroup's limit if lower), or a size SET for the session; 0 reads
the partitions one after another. A smaller read-ahead costs time: on the
96M-edge build above (4 cores), 1 GiB took 8.6 s at 4.2 GB peak RSS, 512
MiB 9.5 s at 3.8 GB, 256 MiB 9.7 s at 3.4 GB, and 0 10.4 s at 3.1 GB.
The index is the same under any value.
- Weak and strong connected components run in parallel, with the same
labels (#383). Both kernels ran on about one core (63 s and 82 s on the
full Bluesky graph, on 16 cores). Weak components now find, per thread and
range of edges, the edges that join two union-find sets, and replay only
those through the serial union-find, so every root is the one the serial
kernel picks. Strong components are found in parallel by trimming and
colouring rounds, over out-edges only (no transpose), and a serial DFS in
Tarjan's order, testing one bit per edge, then names each by Tarjan's root.
Labels are bit for bit the serial kernels', which tests pin per node and
compare at several pool sizes. On a 256M-edge R-MAT graph on a shared
4-core machine: weak 10.4 s to 6.3 s, strong 21.1 s to 13.8 s (the strong
kernel's serial DFS takes 0.25 s of it), with 120 MiB more heap at most
for weak and 70 MiB less for strong, on a 2 GiB graph. The serial kernels
still run on one thread, below 65,536 edges, and without the rayon
feature. Linked::of, run before every compact kernel, also no longer
makes an atomic update per edge.
- SQL: a database always opens (#381, N44). A catalog statement that
fails when the database opens, such as a view over a data file that was
moved, renamed or deleted, or a database copied without its files, no
longer makes the database unopenable (cannot open m.ursa: statement 1 of
its catalog failed), with every statement, DROP included, failing the
same way. The object it defines is unavailable instead, and one notice
says why: ursa: view v is unavailable: no file found at '…/t.csv'; DROP
VIEW v or restore the file. Everything else works, in a writable or a
read-only open; SHOW TABLES and .tables still list it, and using it
fails with that message, as a broken view does in DuckDB. A view or graph
that uses an unavailable object is unavailable too, with its own notice.
DROP (with or without IF EXISTS) and CREATE OR REPLACE repair it.
Its statement stays in the catalog as it was, so restoring the file and
opening the database again brings it back.
- SQL: SHOW ursa.index_storage_limit shows just the value (behaviour
change, #381, N46), 21GiB or 8GiB, like every other setting, not
21GiB (the default: …). Where it comes from starts its description,
which SHOW ursa.index_storage_limit VERBOSE and SHOW ALL VERBOSE show.
The default limit is rounded down to a multiple of 4 GiB (it was a whole
GiB), so it no longer moves between runs as the free space changes a
little.
- SQL: storing an index's reverse adjacency is said (#381, N47). When
the database closes and appends the reverse adjacency (or evaluated
weights) to a stored index, ursa.notices = 'all' says stored the
reverse adjacency of g in club.ursa (+1.0 GiB, 2.3 GiB in all), and
'on' says it too when it brings the stored indexes to 90% of
ursa.index_storage_limit or more. A chunk that cannot be written is
said at 'on'.
- ursa: JSON and NDJSON write null for a null (behaviour change,
#350). Every row object has every column, in column order, as DuckDB
writes them: SELECT NULL AS a, '' AS b is [{"a":null,"b":""}], which
was [{"b":""}], so a missing key no longer stands for a null. The
browser shell's JSON export does the same.
- ursa: CSV and TSV write an empty string as "" (behaviour change,
#350), as DuckDB does, so it can be told from a null, which is still an
empty field: SELECT NULL AS a, '' AS b is ,"", which was ,. The
browser shell's CSV export does the same.
- ursa: a string inside a list, struct or map is quoted in its text
(behaviour change, #386), as in DuckDB, so different values print
differently in CSV, TSV and the table: ['a, b', 'c'] is ['a, b', c]
and ['a', 'b', 'c'] is [a, b, c], which both were [a, b, c], and
['x]', NULL, 'NULL'] is ['x]', NULL, 'NULL'], which was
[x], NULL, NULL]. A string is quoted when it is empty, is NULL in any
case, starts or ends with whitespace, or holds any of
' " \ , : = [ ] { } ( ); a ' or \ in it is escaped with \. Struct
field names and map keys follow the same rule, and a null inside a nested
value is NULL in the table too. The browser shell's table and CSV export
do the same. JSON stays the lossless format for nested results.
- SQL: an index build decodes its source's partitions in parallel
(#351, N30). The build read its edge plan one partition at a time to keep
the order that numbers the nodes, so a filtered view over a large Parquet
file spent its build in zstd decompression on one core while the other
scan workers waited. Each partition now runs as its own task, and its
batches are interned in partition order, so the node numbering, the CSR and
the stored index are byte for byte the ones a serial read gives (a test
checks it over a multi-partition, multi-row-group source). Partitions ahead
of the one being interned hold at most 1 GiB of decoded batches between
them. The vertex keys, and the weights read beside an index, are read the
same way. On a synthetic 120M-row zstd Parquet (1M-row row groups) behind a
filter no statistics prune (t < 5000, 5% kept, 6M edges), on 4 cores:
3.66 s → 1.55 s, against 1.2 s for the parallel SQL scan of the same view.
cargo run --release -p ursa-engine --example filtered_build measures it.
- SQL: the build notice no longer guesses at a filtered view's edges
(#351, N29). Over a filter the statistics cannot settle, DataFusion's
estimate is its default 20% selectivity, so a view keeping 1K of 1M rows
was announced as about 200.0K edges, and Bluesky's 95.7M-edge view as
2.4B. Such a build now says what it reads: reading about 1.0M rows to
build the index for g2…; an edge count is given only when the statistics
have one, exact or unfiltered. The built notice gives the real count, as
before. ursa_engine::graph::BuildInfo holds a BuildSize in place of
its edges pair.
- SQL: EXPLAIN marks a path search over a held index (#351, N38).
PathSearchExec: graph=g, search=…, index=stored (sources not read) (or
index=cached, for one already in the session) says that the edge and
vertex scans drawn under it will not run, where the plan read as if the
index were not used.
- SQL: EXPLAIN no longer draws the scans a held index skips (#384,
N48). Under a path search whose index the session holds, the edge and
vertex scans are now counted on its line rather than drawn as its
children: PathSearchExec: graph=g, search=…, index=stored, sources: 2
files, not read. A path search over an index not held, and EXPLAIN
ANALYZE, are as before.
- SQL: ANY SHORTEST counts the paths it keeps, and the path limit is a
setting, ursa.max_paths (#384, N50). A path search stopped at a fixed
10M paths, counting every partial path it held, and told an ANY
SHORTEST query to use ANY SHORTEST: from one well-followed Bluesky
account, the {1,3} histogram failed, where hop answers at once. Under
ANY SHORTEST (and SHORTEST k), whose search holds at most one (k)
partial path per node, the limit now counts the paths kept, never fewer
than one (k) per node of the graph, so one start node is never refused.
The limit is SET ursa.max_paths = … (default 10000000; 0 for none), and
the error names it, with the remedy that fits the query: a lower upper
bound or ANY SHORTEST without a selector, hop(…) with one.
- Isolated vertices cost the algorithms next to nothing (#326). A vertex
table's keys with no edges are nodes, and on real data they can be most of
them (37.2M of the Bluesky follows graph's 39.65M). pagerank, louvain,
label_propagation, connected_components (weak and strong) and the
triangle pass behind triangle_count and clustering_coefficient now run
on the nodes with at least one edge, and fill in each isolated node's
result, which is closed-form: its own component or community, no
triangles, and for PageRank its share of the teleport and of the dangling
score (an isolated node is dangling too). Results are unchanged, bit for
bit, label values and order included: PageRank carries every isolated node
as one value and adds it into its sums where a run over every node does,
and the community kernels visit the other nodes in the order their seeded
permutation of every node gives. The Python library shares the kernels, so
a subgraph (a filtered edge frame) whose nodes lose every edge gains too.
On an R-MAT graph of 5M edges with its 180K nodes spread among 20M (99%
isolated), the kernels' time and peak memory, before → after: PageRank
4.84 s / 828 MB → 0.44 s / 194 MB, Louvain 18.1 s / 2,342 MB → 2.6 s /
283 MB, label propagation 4.8 s / 240 MB → 1.3 s / 169 MB, weak
components 180 MB → 88 MB, triangle count 258 MB → 105 MB; the memory left
is mostly the result, one value per node (0.06 s / 5 MB and 1.3 s /
276 MB for PageRank and Louvain without the isolated nodes). What remains
per isolated node is the result and, for the community kernels, the seeded
permutation of every node, whose order they keep. cargo run --release -p
ursa-core --example isolated_vertices measures the kernels, and
benchmarks/sql_scale/isolated.py the ursa binary end to end. The function
reference says what isolated nodes still change: PageRank's scores sum to
1 over every node, so more keys give lower scores, and each isolated node
is a community, so count(DISTINCT louvain) counts them; count
communities of more than one member with GROUP BY louvain HAVING
count(*) > 1.
- Louvain builds its working graph in less memory (#352). The graph was
scattered into padded (u32, f64) pairs, 16 bytes an entry, and copied
out while they were still held, so building it peaked at about the sum of
two copies of the adjacency (5.9 GB on the Bluesky follows graph, 95.7M
edges). Now the scatter buffers become the final arrays, compacted in
place; targets and weights are separate arrays (12 bytes an entry); and an
unweighted run scatters 4-byte targets and counts its parallel edges for
their weights. Results are unchanged, bit for bit. On an R-MAT graph of
100M edges (4.3M nodes), Louvain's peak heap went from 5,734 MB to
3,704 MB unweighted and to 4,928 MB weighted (peak RSS 6.50 → 4.08 GB and
7.28 → 5.57 GB); the building step itself fell from about 5.5 GB to about
2.4 GB, and the peak is now aggregating the first level. cargo run
--release -p ursa-core --example louvain_memory measures it.
- Louvain aggregates its first level in less memory (#359). Collapsing
each community into a super-node ran while the level-0 graph was held, and
grew its output in per-block vectors that were then concatenated. It now
counts each community's neighbouring communities first and writes the
aggregated graph straight into arrays of its exact size. And when every
weight is a whole number (any unweighted run, or integer weights), each
node's edges are first collapsed in place to one entry per neighbouring
community and the level-0 arrays shrunk, before the aggregated graph is
allocated: every sum there is exact, so the regrouping changes no bit.
Results are unchanged, bit for bit. On an R-MAT graph of 100M edges
(4.3M nodes), Louvain's peak heap went from 3,704 MB to 2,594 MB
unweighted and from 4,928 MB to 3,757 MB weighted, and peak RSS from 4.13
to 3.42 GB and from 5.50 to 5.36 GB, at the same speed. (Much of the old
vectors' slack was never written, so it was never resident: RSS falls
less than the heap.) Unweighted, the peak is now local moving on the
level-0 graph; weighted with inexact weights, it is still the first
aggregation, now holding just the level-0 and level-1 graphs.
- SQL: hop returns (seed, id, distance) (breaking, #328). It
returned (src, dst), but its rows are nodes reached from a seed, not
edges: seed is the seed, id a node reached and distance (Int64) the
fewest steps from the seed to it. Rename src to seed and dst to id
in queries over hop. The Python library's ur.hop is unchanged: it still
returns an EdgeFrame of (src, dst).
- SQL: notices about stored indexes and slow builds (#327). The engine
says, one line each, what it does on its own that a user waits for or
loses; ursa prints them on stderr as ursa: …, so stdout holds only
results. At ursa.notices = 'on' (the default): an index build that runs
for more than a second (building the index for g (95.7M edges)…, then
built … in 30.7 s; stored in club.ursa (1.4 GiB)), and every index not
stored (larger than ursa.index_storage_limit, with the SET that keeps
it; or the database is read-only), evicted, or whose write failed. 'all'
adds every build, load and store; 'off' and ursa --quiet (-q) print
none.
- SQL: the lock error names the other process and suggests
ursa --readonly to query meanwhile (#327).
Changed¶
- SQL:
SETlasts for the session (behaviour change, #353; reverses #327's persistence).SETandRESETchange only the current session, in any database, writable or read-only, as in DuckDB, Postgres and DataFusion: nothing is written to the catalog. Since 0.8,SET ursa.index_storage_limit = '50MiB'in a writable database was saved for good, and a limit tried "for now" evicted gigabytes of indexes at the next build. To keep a setting, put theSETin~/.ursarc(the shell) or an-initfile (scripts too). A limit 0.8 or 0.9 saved is no longer applied: opening the database says so once (ursa: club.ursa has a saved ursa.index_storage_limit = 50MiB, which is no longer applied; …), and a writable open removes it from the catalog. - Lowering the limit never removes a stored index. A limit decides
only whether a new index is stored; eviction makes room for a new index
under the session's limit, least recently used first, never more than it
needs. If the stored indexes already take more than a lower limit, no new
index is stored and nothing is evicted, and the
SETsays so (ursa: 3.8 GiB of indexes are stored in club.ursa, more than the 50MiB limit; they are kept, and new indexes won't be stored). - The default limit follows the disk (N32): 25% of the free space on
the database's disk, counting the indexes it stores, in whole GiB, at
least 4 GiB (the old default) and at most 64 GiB. At 4 GiB, three graphs
over the same 95.7M edges evicted each other, each eviction costing a
30 s rebuild later. The setting's value is
autountilSET, andSHOW ursa.index_storage_limitsays the limit in effect and where it comes from (8GiB (SET for this session), or25GiB (the default: 25% of 100.2 GiB: …)). - The
storednotice says how the index grows once an algorithm adds its reverse adjacency (about 1.75×):stored in club.ursa (768.0 MiB; about 1.5 GiB once an algorithm adds the reverse adjacency), or(…, with its reverse adjacency)when it is already in it. - SQL:
ursa.index_storage_limitbelongs to the database (behaviour change, #327; its persistence is reversed by #353 above, andSETnow lasts for the session).SETin a writable database is stored in the catalog (a newsettingsobject; older versions ignore it), applied when the database is opened and shown bySHOW;RESETgoes back to the default. Stored indexes obey only the stored limit or the default: a read-only or in-memory session'sSETlasts for that session and never evicts, so a temporary small limit can no longer delete a large stored index. Eviction runs only to make room for an index being stored, least recently used first, evicting no more than it must and never an index a running query uses; if those leave no room, nothing is evicted and the new index is not stored. -
SQL: a portable stored-index key (#327). Paths inside the database's directory are part of the key relative to it, so a database moved with its data keeps its stored indexes; a file named in
FROMis keyed by what it reads rather than the name it was written as, so a view defined in this process and the same view replayed later share an index; and only the file options that change what is read are in it, not DataFusion'sDebugtext of every listing option, so an unrelated setting or a DataFusion upgrade no longer invalidates every index. The manifest is version 2: indexes stored by earlier versions are removed once by the first writer (with a notice) and built again when first used, never read under the old key. -
SQL: a vertex table defines the graph's node set (behaviour change, #311). With
VERTEX TABLES, every algorithm, statistic, traversal,neighbors_aggandGRAPH_TABLEpath search runs on the vertex table's keys, as SQL/PGQ and DuckPGQ do: a node on no edge is a node (degree 0, a row in every result, a seed that reaches nothing), and a subgraph over a filtered edge view keeps every vertex, as a filtered edge frame in Python keeps its parent's nodes (parity tests cover it). Before, the algorithms saw only the edges' endpoints, so isolated vertices were missing anddescribe(g, nodes => 'all')and'touched'agreed. An edge whose source or destination is not a key is now left out, as DuckPGQ's inner join leaves it out;describereports how many in a new column,n_dropped_edges(0 without a vertex table).g.nodeslists the vertex table's rows only (it used to add such endpoints with NULL attributes);g.edgesis still every row. Graphs without a vertex table are unchanged. The vertex keys are read as one column, streamed and interned before the edges, and are part of a stored index's key, so changing the vertex table rebuilds the index; indexes stored before this change stay valid for graphs without a vertex table. - Behaviour change (SQL):
neighbors_agg'scountandn_uniquereturnUInt32, asdegreedoes, notFloat64.minandmaxtake strings, dates, times and timestamps too, and return a value of the same type (#313). The Python library is unchanged. - The crates
ursa-cliinstalls from crates.io (ursa-core,ursa-io,ursa-engine,ursa-sql,ursa-cli, and since 0.9.0ursa-shell) are released together at one version, since 0.7.0.ursa-coreandursa-iono longer follow the Python package's version, and the release workflow refuses a tag where any of them differ. A development build'sursa --versionnames its commit, for exampleursa 0.7.0-dev (a1b2c3d4e). Releases publish to crates.io by Trusted Publishing, with no stored API token. ursa-clireleases can start from GitHub: Actions -> Release ursa-cli -> Run workflow onmain, withreleaseand the version. The run builds and tests every target, then tags the commit it built; publishing still waits for the maintainer's approval. Pushing a tag works as before.- Stable and nightly channels for
ursa-cli(#323, after 0.8.0). A stable release now starts by itself when a release PR is merged: the merge tomainthat sets a new release version builds every target, tags the commit, publishes to crates.io with no approval step, and makes the GitHub Release. Every merge tomainat a-devversion also refreshes one rolling GitHub prerelease,nightly, with binaries only (nothing on crates.io). Install it withcurl -fsSL https://cldixon.github.io/ursa/install.sh | URSA_CHANNEL=nightly sh(orsh -s -- --nightly), or$env:URSA_CHANNEL = 'nightly'before the PowerShell installer. The default stays stable. A nightly'sursa --versionnames its version, date and commit, for exampleursa 0.9.0-nightly.20261107 (a1b2c3d4e). - Behaviour change:
.functionslists each graph function's name, family and the first sentence of its summary; before, it printed every column ofursa_functions(), too wide to read. A statement that returns rows prints its header even with no rows, and DDL andSETprint nothing; a test now holds every kind of statement to that (#312). CREATE PROPERTY GRAPHerrors put their hint after the main clause: "multi-column keys are not supported yet at Line: 2, Column: 36; KEY, SOURCE KEY, DESTINATION KEY and REFERENCES take one column". Before, the hint sat in parentheses in the middle of the sentence (#312).- A weighted algorithm over
scan_edgesreads the file as a stream. It builds the index and evaluates the weights one batch at a time, so the rows are never all held in memory. Before, it collected every row first. Weighted PageRank on a 20M-edge R-MAT graph now peaks at 615 MB, down from about 1,040 MB; the SQL engine peaks at 589 MB. Results are bit-identical (#267). - The node-id rules for an in-memory table now run in Rust, in
ursa_io::ids, the same code a scan and the SQL engine use. These rules are: which column types hold ids and what they canonicalize to,string_viewcolumns read as strings, and the rowson_null="drop"removes. Before,python/ursa/_io.pyheld its own copy. Errors, warnings and drop counts are unchanged. Withon_null="drop"and no null endpoints, the table's columns are no longer copied (#269). - Source reading moved out of the
ursa-plancrate into a new workspace crate,ursa-io: Parquet and CSV scans, the CSV options and type inference, the Parquet statistics guard, object-store and URL handling, and building a topology from a scan. It does not depend onursa-plan, so any engine built on Ursa reads files as the DataFrame library does.ursa-plandepends on it and re-exports what it used, so nothing else changes: the Python API, results and error messages are the same (#233). - The graph functions' specs and dispatch moved into
ursa-core, asursa_core::catalog: each algorithm's, layout's, neighbour aggregation's and statistic's parameters, defaults, accepted values, directions, output columns and NetworkX equivalent, the validation of a call's arguments, and the kernel dispatch (with the work sharing betweentriangle_countandclustering_coefficient, the symmetric views and a layout's two columns).ursa-planresolves and runs every graph column through it, so the DataFrame library and the SQL engine share one implementation. The Python API, results, row order and error messages are unchanged (#236). - Upgraded DataFusion 54 → 55.2, arrow,
arrow-pyarrowand parquet 58 → 59.3 and pyo3 0.28 → 0.29 (object_store stays on 0.13, the line DataFusion 55 uses). Results, row order and error messages are unchanged. Building from source now needs Rust 1.94 or later (DataFusion 55's minimum; was 1.88). - Behaviour change:
shortest_pathtakes one node id forsourceand one fortarget. A list, tuple, array or other sequence of several ids (or of none) raisesValueErrorwhereshortest_pathis called, naming the parameter and how many ids it got:shortest_path(source=) must be one node id; got 2 ids. …. It raisedNotImplementedError: seed ids must be all integers or all strings.atcollect(). A sequence of exactly one id is that id, as the SQL engine reads it; it raised the sameNotImplementedError(#252). - Behaviour change: a traversal's node ids (
hop(...).from_(),random_walk(start=),shortest_path(source=, target=)) are integers or strings, as in SQL. A float, a bool, a date or any other value raisesTypeErrorwhere the traversal is called (hop(...).from_() must be node ids, integers or strings; got 1.5); it was converted withint(), so1.5ran as1andTrueas1. Ids are fitted to the graph's id type when the plan runs: on a graph of integer ids, a string that spells an integer ('7') is that integer, where a list of only strings raised; on a graph of string ids, an integer is its string, where it raised. A string that is not an integer, on a graph of integer ids, raisesComputeError: the node id 'a' is not an integer, but the graph's node ids are int64; …, which saidthe node ids given are string but the graph's node ids are int64; …(#271).
Fixed¶
-
Web Shell: the aggregated view's e2e checks wait for the cut's frame (URSA-19). A cut through the layout's hierarchy (#498) is drawn, and its largest groups labelled, by the frame after the layout worker's answer; but the view's test hook said it waited for nothing as soon as the answer was in, so a check that read the labels then, under load before that frame, found none (
a big graph: its largest groups are labelled with their node counts: [], seen overursa serve). The hook'scuts.waitingnow also covers a cut, or the graph in place of one, that no frame has drawn yet; and a new check holds the animation frames to see it wait. The zoom into rmat also starts once the camera has given back the room it made for the inspector's panel (#493): under load the first zoom's cut was of a camera still moving (76 groups for the fitted 92). -
Web Shell: a
.graphthat fails downloads none of the graph view (URSA-11). The pane opens with "Loading graph view…" once the engine has taken 150 ms, and it began downloadinggraph.jsandursa-vizthen; so an error that took longer to say, as on a busy machine, downloaded a few MB for nothing. The view's code is now first downloaded once the engine has the graph; the pane still opens at 150 ms, and once the code is here it starts a layout worker then, as before. And the e2e checks of the graph view no longer depend on the machine's speed:.graph's errors download no view (as above);graphSettledwaits for the layout's last positions to be drawn, not just its "done", for every check that uses it (URSA-10 did so for GROUP BY alone); and the checks that click or probe a node or an edge after a selection does so where it is once the camera has made room for the inspector's panel, or given it back (#493), not where it was 450 ms before: the edge pick within 4 px (under load the room was made first, and both picks missed), Shift+click, the drag that pans, several nodes' WHERE clause, the panel's side for the rightmost node, and colour by. -
A graph with a vertex table builds its index as fast as in 0.10 again, and faster (#532). Since 0.12 the edges read while the vertex keys are still being numbered are interned provisionally, then renumbered (#385). That provisional interner gave its direct table of integer ids a slot per edge row, as the final one does, so with keys that are compact integers (Bluesky's) the few distinct ids of the early edges, spread over the keys' whole range, grew the table to about one slot per edge, and it grew one full copy at a time, on the edges' thread. It now keeps a direct table only while that is dense in its own ids (4 slots per id), else a hash map, and the index is the same. Four more passes of the build no longer run on one core: settling a chunk of edges (keeping the rows between two nodes) checks in parallel and copies nothing when no row is dropped; interning new ids visits only the 4,096-row blocks that have one; the CSR's per-node passes over the chunk histograms run over ranges of nodes in parallel; and the stored id lookup table (#421) is filled by every thread at once, giving the same table as filling it in id order (linear probing with priority to the lower id is history independent). On a synthetic Bluesky-shaped graph (a Parquet vertex table of 40M compact integer keys, 100M edges between 2.5M of them; 4 cores,
--readonlydescribe(g, full => true), three interleaved runs, build time from the notice): 0.10.0 7.8–8.6 s,mainbefore this 9.9–10.5 s, now 7.9–8.8 s, with system time back from 5.6–5.8 s to 3.7–3.9 s (page faults halved: 1.63M to 0.82M on one thread). With a.csv.gzvertex table: 0.10.0 10.3–10.6 s, before 10.4–10.6 s, now 8.7–8.8 s. Edges only: 7.6–7.8 s, 7.9–8.8 s, 7.6–7.8 s. With 40M sparse integer keys: 16.5–18.4 s, 11.9–14.0 s, 11.9–13.0 s. Stored (a writable database), the whole process: 14.0–14.8 s, 17.9–18.0 s, 15.1–15.5 s; the rest is the 0.24 GB larger v4 file. The stored index files are byte-identical before and after (compact, sparse and string keys, and the.csv.gztable), and a test pins a hash of the stored index of a graph with a vertex table, for integer and string keys, recorded before the change. -
SQL: a query that fails writes nothing to stdout, not even its header (#388).
ursa --format csv -c "SELECT count(*) …"wrote the header (count(*)), then the error, and exited 1, so a script read a header with no rows. Every output format now waits for the first row, or for the end of a result with none, before it writes anything; an empty result that succeeds still writes its header, as before and as in DuckDB. (Rows are written as they arrive, so a query that fails after its first rows were written has written them.) - SQL:
COLUMNS (p)says a path cannot be a column (#388). A path variable alone inCOLUMNSsaid'p' needs its variable, as a.p. It now says'p' is a path variable, and a path cannot be a column; use path_length(p), vertices(p), edges(p) or element_id(p). A node or edge variable alone says the same of a node or an edge, and names one of its properties andelement_id. - SQL:
SET ursa.max_pathswith a bad value says what it takes (#388).SET ursa.max_paths = -5(or'lots') printedError parsing '-5' as usize: invalid digit found in string; it now saysursa.max_paths must be a non-negative integer (0 for no limit); got -5, as the other settings name theirs.ursa.graph_max_edgestoo. And aursa.max_pathsbelow the floor anANY SHORTESTsearch keeps to (one path per node of the graph;kper node forSHORTEST k) is said in a notice on stderr,ursa: ursa.max_paths 1000 is below the node count; ANY SHORTEST keeps up to 39650447 paths, where it was silent. Results are unchanged. - A large graph's first frame comes sooner (#525). On
.graph rmat(1M edges) in the Web Shell it is shown 0.69 to 0.84 s after Enter where it was 1.0 to 1.3 s, on a machine busy with other builds (ursa-viz/BENCH.md, "The first frame"; the 0.6 s the issue asks for is not reached, and the section says what it would take). The final layout is the same, bit for bit. .graph NAMEof a property graph that is one edge table (no vertex table, endpoint columns of one integer or string type) is drawn from the session's index of the graph, the one its algorithms run over, and not from its rows: with the index cached nothing is scanned. The drawing is the one the rows give (the same nodes and edges in the same order); a graph the index cannot answer for (a NULL endpoint, a vertex table, more edges thanursa.graph_max_edges) is read from its rows as before. The first.graphof such a graph builds the index if no algorithm has, and a session with a database stores it, as an algorithm would. In the browser the engine answers in 0.14 to 0.23 s where it took 0.36 to 0.54 s, and holds 6 to 14 MiB less: the result is not copied before its bytes are written.ursa-core: a layout's hierarchy no longer sorts the rows of its coarse levels (Fa2Multilevel: a row's targets are read off a bitmap), norUndirectedCsr::from_edgesthe long runs of an adjacency: 140 to 150 ms where it was 200, and 28 ms where it was 39, natively for a 1M-edge R-MAT graph on one core. Both are checked against a sort of every edge.ursa-viz: a view made in pieces gives the event loop its turns as messages, not timers, which a browser makes wait 4 ms each once they nest (pace); the turns that wait for the GPU are timers still.-
The shell's layout worker lays out a small random graph a few times before the graph comes, so that the browser has compiled the layout's code well by then (
graph-worker.js). -
Making the graph view of a large graph no longer holds the page for over 60 ms (#520). On
.graph rmatin the Web Shelltests/graph-timing.tssaw one task of 51 to 80 ms while the view was made, in four runs of five over its limit of 60 ms. It was the last task ofcreateViewFromResult: the shader, the two pipelines and the first draw of the coarse levels (#514), 43 to 46 ms in one go, and then, with no turn of the event loop between, the page's own work with the view it was handed, 12 to 27 ms. Each is now a piece, paced as the rest of the view is (#426):View::warm_levels_pacedandLevelRenderer::new_pacedinursa-viz;createViewandcreateViewFromResultgive the event loop a turn before they resolve, and one between making the canvas's context and asking for the device; and the shell counts the degrees in a task of its own. Six runs of six have no task over 50 ms (ursa-viz/BENCH.mdhas the spread); making the view takes up to six turns of the event loop longer, about 4 ms each. What is drawn is the same. -
Web shell:
COPY … TOwrites a file in the session, and no longer ends the engine (#517). A browser has no disk, soCOPY … TO 'pos.parquet'(or.csv,.json,.arrow;'memory://uploads/pos.parquet'is the same file) keeps the file in memory beside the imported ones:FROM 'pos.parquet'reads it, a session file being found by its name before the datasets' files, and.fileslists it aswritten here. So a layout is saved as the CLI saves it:COPY (SELECT * FROM layout_fa2(g)) TO 'pos.parquet', then.graph g POSITIONS (SELECT * FROM 'pos.parquet'), which the terminal's hint for a large graph now gives first. Before, a relative path failed with "relative URL without a base", and amemory://uploads/…target ended the engine: DataFusion's file sinks start tokio tasks, and the browser has no tokio runtime to start them on. The engine now writes the file itself in such a session (ursa_engine::session_files), with the serializers and options DataFusion's sinks use. What it cannot write is refused with a message that says what works: a name with a folder or other characters than ASCII letters, digits,.,_and-; a URL elsewhere;PARTITIONED BY; compressed CSV or JSON; andINSERT INTOa table of files orEXPLAIN ANALYZEof aCOPY, which ran the same sinks. An.arrowfile is written uncompressed.WebShell.files()lists the session's files. The CLI'sCOPYis unchanged. -
Graph view: a snapshot of a level, a cut or a grouped drawing is of the view as it is (#499).
GraphView.snapshot()drew the discs the last frame had given the GPU, so a read-back taken before the next frame still showed a selection ring that had been cleared.GraphView.refreshLevel()gives the GPU the discs as they are now, and the page's read-back calls it first. On screen nothing changes: a frame always did. The snapshot borrows the view shared, as it did before (it borrowed it to change it for a day, and every call made during a read-back then threw and left the view unable to be freed, so the next.graphfailed to start); the pane's hover waits for a read-back, and a pane closed or drawn again during one frees its view when the pixels have come. A read-back also gives the view the layout's newest positions first (URSA-10): a small grouped layout's last positions can come with its "done", before the frame that draws them, and a read-back then drew the discs where the frame before had them (the flaky e2e checkGROUP BY: .undo restores the closed drawing, at 28409 px for 28729). And where the page gives the view those positions ahead of a frame (a test hook's lookup, a fit to the selection), a grouped drawing's discs move with them; they stayed where they were until the layout's next positions. The check itself now clears the selection, and waits for the camera to give back the room it made for the inspector's panel, before.undo: under more load the panel's room was in the read-back. -
Shell: the DuckDB dot-commands people reach for first (#418).
.mode markdownwrites a Markdown table, as DuckDB does (names centred, a number column's separator ending in:,NULLfor a null; a|in a value is\|)..mode linewrites onecolumn = valuea line, a blank line between rows. Both are--format markdownand--format linetoo.- DuckDB's mode names work:
duckboxandboxaretable,jsonlinesisndjson,linesisline, in.modeand--format. .output FILEsends what the shell prints to a file until.output;.once FILEfor the next command only, so the output ofSHOW GRAPHSorDESCRIBE GRAPHcan be saved too..schema ?PATTERN?prints the statements that define the database's views, external tables and graphs (the session's views without a database file), each ending with;..headers on|offturns the header row ofcsvandtsvon or off..helpnames the DuckDB aliases..nullvalue,.separator,.databasesand.shellare not added.- SQL: loose ends of unavailable objects (#401, after #381).
g.edgesandg.nodesof an unavailable graph fail with the graph's message, as its functions,GRAPH_TABLEandDESCRIBE GRAPHdo; they said "table not found".- The notice's remedy follows the cause:
or restore the filefor a missing file,or fix the cause and open the database againfor anything else (expireds3://credentials, a network error, a file without the columns a view reads). - Repairs reach dependants: after
CREATE OR REPLACEorDROPof an object, the objects unavailable because they use it are defined again from their catalog statements, so repairing a view brings back the views and graphs over it without reopening the database. One that still fails says why, and is tried again after the next change. CREATE OR REPLACE EXTERNAL TABLEover an unavailable table, with a definition that fails too, keeps the table (unavailable, as it was); it disappeared for the rest of the session.- SQL:
SHOW GRAPHSlists unavailable graphs, with astatusand areason(behaviour change, #401). A graph of the database that could not be defined when it was opened (a file it reads was moved) was left out, so it looked lost, andCREATE PROPERTY GRAPHwith its name said "already exists" for a graph nobody could see. It is now listed from its stored definition, as DuckDB lists a view over a missing file, and two columns are added aftervertex_key:status,okorunavailable, andreason, NULL for a usable graph and otherwise the notice's message aftergraph g is unavailable:(no file found at '…'; DROP PROPERTY GRAPH g or restore the file). A vertex key the stored definition leaves out is NULL for such a graph..graphsshows the same.SHOW TABLESalready listed unavailable views and tables. - A truncated or fake
.parquetfile is an error, not a crash (#332). A file whose footer claims more metadata than the file holds (a truncated download, a file still being written,PAR1PAR1) made the parquet crate subtract with overflow: a panic in a debug build, a garbage read in a release build. Ursa now checks each Parquet file's ends before the parquet crate reads it (at least 12 bytes,PAR1at both ends, a metadata length that fits) and names the file:cannot read 'x.parquet': it is not a valid Parquet file: it is 8 bytes, and a Parquet file is at least 12. It coversFROM 'x.parquet', globs,read_parquet,CREATE EXTERNAL TABLE … STORED AS PARQUET, graphs over them, and the Python scans (scan_edges('x.parquet'):the file is not valid Parquet (…)), in the CLI, Python and the browser alike. arrow-rs fixed the overflow in parquet 60; Ursa is on 59 until DataFusion moves. - SQL:
DESCRIBE FROM tlists the columns (#417). It returned a table of no rows, for a table or a file (DESCRIBE FROM 'edges.csv'): the FROM-first rewrite did not run underDESCRIBE, so the statement described a query of no columns.DESC FROM t,EXPLAIN ANALYZE FROM tandEXPLAIN VERBOSE FROM t, which failed to parse, work too. - SQL: an edge table's endpoints may be integers of different widths
(#416).
SOURCE KEY (src) DESTINATION KEY (dst)with anINTand aBIGINTcolumn was refused ("must have the same type"), though a vertex key of another width was accepted and node ids areBIGINTwhatever the stored type. Any two integer types are now one graph, as are two string types; an integer against a string is still an error. - Ursa Web Shell:
.graphno longer draws scores or paths as nodes (#427). The two columns.graphreads as each edge's ends must hold ids: integers, strings or dates, and, when they are the first two columns rather thansrcanddst, both of one kind. A float, a boolean, a list or a struct is refused, naming the columns and their types and what to type instead. AfterSELECT * FROM pagerank(karate) LIMIT 5,.graphdrew five edges from each id to its score; after anANY SHORTESTquery, one edge from a number to a list. Now:cannot draw the first two columns (id: Int64, pagerank: Float64) as edges: 'pagerank' is a number that is not whole (Float64). … To draw an algorithm's result, draw the graph and size or colour it: .graph NAME SIZE BY pagerank. To draw other rows, name the ends: .graph SELECT … AS src, … AS dst FROM …. Columns namedsrcanddstof those types are refused the same way. Two integer or two string columns draw as before. ursa --format csvandtsvwrite lists, structs and maps, as DuckDB does, as their text form, quoted where CSV needs it ("[1, 2]", withNULLfor a null inside one). They failed with "Nested type List(Int64) is not supported in CSV", sovertices(p),edges(p),array_aggandrandom_walkpaths could not be written (#350).- A table shows an untyped null (
SELECT NULL AS n, of typeNull) asNULL, as it shows a typed one; the cell was blank (#350). - The skill and the shell page say which format to read results in (
jsonorndjson), that a table shows at most 40 rows while CSV and JSON write every row, and that piped output is never cut to a width (#350). - Ctrl-C in the
ursashell printsInterrupted(stderr) and draws the prompt again at once. The signal was waited for on the query's own runtime, so a statement that kept every worker busy (an index build, a large join) could hold it back; it said^C (cancelled)when it was seen (#354). - An error names the file it cannot read once:
cannot read 'x.csv': Csv error: …, notcannot read 'x.csv': cannot read /…/x.csv: Csv error: …. For a glob or a list it names the file that failed. A Parquet error saysParquet error: …, notParquet: Parquet error: …(#354). - The docs and the skill take the top k before joining attributes
(
WITH top AS (SELECT * FROM pagerank(g) ORDER BY pagerank DESC LIMIT 5) SELECT … FROM top JOIN g.nodes USING (id)), and say why: anORDER BY … LIMITis not moved below a join, so joining first sorts every node's attributes too, about twice the memory on a large graph (#354). -
The docs' landing page leads with Ursa SQL: the install one-liner and a
CREATE PROPERTY GRAPHandpagerankexample, run in CI with the SQL docs. The Python library is the second path (#354). -
The browser shell's accessibility, look and onboarding. Tab and Shift+Tab move the focus out of the terminal (they inserted spaces, so the keyboard could not leave it), and the Datasets menu is a menu button: arrow keys, Home, End, Enter, Space and Escape. A click on the theme toggle, Import, Share, New or a dataset hands the keys back to the terminal; from the keyboard the focus stays put. The grey text (types, footers, nulls) is 5.5:1 on white (it was 3.6:1). The logo is drawn at a legible size, the favicon has no white tile and follows a dark browser, and the scrollbars take the theme. On a phone the bar is one row (icons for New, Share and Import under 420px), the terminal's input is 16px so iOS does not zoom in, and a dataset's SQL is broken at spaces to fit the screen rather than wrapped mid-word. Each dataset explains its steps in
--comments at the prompt, and the R-MAT dataset turns.timer on. -
The browser shell no longer crashes on a fixed-length
GRAPH_TABLEpattern from a bound node (MATCH (a WHERE a.id = 0)-[e]-(b)). rustc miscompiled the path search's target check atopt-level"s" and "z", the browser engine's build, and indexed past the end of an empty list; the check is written without the nestedOptionit miscompiled. CI's browser test now builds at "z" too, and runs aGRAPH_TABLEstep. -
The browser shell's line editor:
- CJK and emoji take two cells and combining marks none, so the cursor is where the characters are, and a long CJK line that wraps is drawn once (it left a copy of its prompt for each edit). An emoji sequence (a ZWJ family, a skin tone, a flag) is one character on screen, and Left, Right, Backspace and Delete move over and delete what is seen as one character whole; they split emoji into broken halves.
- A line of several that fills the terminal's width exactly no longer leaves an empty row after it.
- Resizing the window redraws what is being typed for the new width at once; it was left as the terminal rewrapped it until the next key.
- A line typed and run before the highlighter answered is coloured in the scrollback; it stayed plain. Late replies for text since changed are dropped.
- Shift+Enter adds a line without also sending the line to the shell.
-
.help shortcutslists every key the editor knows, and only those: Left and Right, Home and End, Backspace and Delete, Tab and the Ctrl keys were missing, and Up and Down move between the lines typed first. -
A CSV file DataFusion cannot read is named by its path, with its leading
/(cannot read /Users/me/x.csv: …), not by its object store location (Error when processing CSV file Users/me/x.csv); stored index keys keep local paths whole too (#327). RESET ursa.<setting>works; DataFusion refused it for Ursa's settings.ursa --format csv … | head(andtsv) ends quietly with status 0 once the reader is gone, as the other formats do. Before, it printed "Error: Csv error: Broken pipe" and exited 1 (#317).
Security¶
- The browser shell is safer to open from a link. A shared link
(
#run=) lists its commands and asksRun N shared commands? [y/N]; onlyyruns them, and a link's.exportis skipped, so it cannot download files. Control characters (ESC above all) in a replayed command are shown as escapes (\u{1b}), and.printwrites them so in the CLI too, keeping lines and tabs, so text cannot move the cursor or restyle the terminal. Import takes any file name (données.csv,a#b.csv,order.csv), and its errors print below the prompt instead of over it. The Worker answers a path with a malformed%escape with 404, not 500, and every response carries a Content Security Policy (frame-ancestors 'none', the page's own scripts, fonts and fetches only),X-Content-Type-Options: nosniffandReferrer-Policy: no-referrer; the local preview server sends the same, and the e2e test checks them and that the page runs with no violation. - The upgrade clears RUSTSEC-2026-0435 (
thrift0.17, a parquet 58 dependency that parquet 59 no longer has) and RUSTSEC-2026-0176/0177 (pyo30.28), and dropspaste(RUSTSEC-2024-0436) from the tree. Bumpedzstd0.13.3 → 0.13.4,zstd-safe7.2.4 → 7.4.0 andzstd-sys2.0.16 → 2.1.2, the patched releases on the 0.13 line, for RUSTSEC-2026-0391/0398/0403/0410. Their waivers are gone fromdeny.toml; onlyquick-xml0.39 (RUSTSEC-2026-0194/0195, via object_store 0.13) remains waived.
0.5.0 — 2026-10-31¶
Added¶
- CSV options on
scan_edges,scan_nodes,read_edgesandread_nodes:delimiter,has_header,quote,escape,null_valueandcomment, passed to DataFusion's CSV reader. The defaults read a file as before (comma-separated, a header row,"quotes, an empty field as null). The options are checked where the scan is made: each character option is one ASCII character other than a line break, the four must differ, and an option on a scan with no.csvpath raisesValueError.escapeapplies inside a quoted field, as in the CSV reader DataFusion uses; in an unquoted field it is an ordinary character.null_valuereads that text as null, as an empty field is read. DataFusion 54 applies a null pattern when it infers a schema but not when it reads rows, so with anull_valueUrsa reads each file with the same arrow-csv reader, options and inferred schema, plus the pattern: every value parses (or fails to parse, with the same error) as it does without anull_value; only which fields are null differs. Such a file is read whole rather than in byte ranges. The tests compare each layout withpyarrow.csvgiven the same options, with empty fields read as null in both (strings_can_be_null=True) and pyarrow's headerless column names (f0,f1, ...) renamed to Ursa's (column_1,column_2, ...) (#216). -
A scan of a list of paths collects: the paths (files or globs) are read as one table, in the order given, as the files read into memory and concatenated would be. Every graph operation sees that table, weighted algorithms included: one index over the union of the files, with the weights read from the same rows. The reshaped-topology cache keys such a scan by every file it reads. A tuple works as a list, and a path may be a
pathlib.Path. The paths must have the same columns and types (their nullability may differ), and be on one store; otherwisecollect()names each column that differs, its type in each file, and what to do. Each CSV path infers its own types, so a column of1s in one file and0.5s in another is such a difference, as it is for a glob (#216). -
ur.density,ur.avg_path_lengthandur.diametertakelazy=True, which returns a lazy one-row frame likeur.describe: one non-null column named after the stat (densityandavg_path_lengtharefloat64,diameterint64), withschema(),explain()and the relational methods. Called as before they still return a Pythonfloat/int: they now collect that frame (#213). ur.describe(edges, nodes="touched")describes only the nodes the view touches, those at an end of a kept edge: over a filter or a traversal result,n_nodescounts them,densityandavg_degreedivide by that count, andn_componentsleaves the other nodes out. These are the figures a new frame over the kept rows gives. The default,nodes="all", keeps the parent's node set as before; over a whole graph the two agree. Any other value raisesValueError: describe(nodes=...) is not supported; use 'all' or 'touched'.wheredescribeis called (#213).frame.schema()returns the schemacollect()returns, as apyarrow.Schema(names, types, nullability and metadata), on every frame: sources and scans, graph columns, joins,group_by, traversals, walks anddescribe. It runs nothing: the plan is built over empty inputs, so a scan reads its file's schema and no rows, and no graph index is built.frame.explain()now shows the plan's steps (one line each, with the frames a step reads indented under it), that schema, and the DataFusion logical plans a collect runs, optimized;explain(physical=True)adds their physical plans. Both are generated in Rust. The text is for reading, not a stable format (#193).- Criterion micro-benchmarks for the
ursa-corekernels (cargo bench -p ursa-core,ursa-core/benches/kernels.rs): topology build and views, id interning, and every kernel family on seeded Erdős–Rényi and R-MAT graphs up to 1M edges. ABenchworkflow runs them weekly and on demand;benchmarks/README.mddescribes comparing two commits (#187).
Changed¶
- Behaviour change: every function that takes an edge frame checks it
where it is called:
density,avg_path_length,diameter,describe, each graph algorithm (degree,pagerank,connected_components,triangle_count,clustering_coefficient,betweenness,closeness,label_propagation,louvain),neighbors,hop,shortest_pathandrandom_walk. A node frame, a graph verb, adescribe, stat orrandom_walkresult, a collected result, a table or any other value raisesTypeError, which names the function, what it got and what to pass:density() takes an edge frame (from ur.from_arrow(..., src=, dst=) or ur.scan_edges); got a node frame (ur.degree(...)); pass the edges the verb was built from.Before, a frame raisedNotImplementedErrorabout a call the user did not make (with_columns() of a graph verb is not supported on an edge frame ..., orcollect() needs edges from ur.from_arrow(...) ...), and any other value raisedAttributeError(density() takes an EdgeFrame (the graph) as its edges; got int). A graph algorithm raised only when its frame was used or collected; it now raises where it is called, and the edges are checked before the other arguments. An edge frame of any kind, ahoporshortest_pathresult included, gives the same result as before (#223). - Behaviour change: an unknown keyword argument to
scan_edges,scan_nodes,read_edgesorread_nodesraisesTypeErrornaming the function called (read_edges() got an unexpected keyword argument 'foo'.), with the option to use for another library's name for one (sepandseparator→delimiter,header→has_header,na_valuesandnull_values→null_value,quotechar→quote,escapechar→escape), or the closest option it takes for a misspelling (delimter→did you mean delimiter=?). It raisedNotImplementedError: scan format options (...) are not supported yet(#216). - Behaviour change: a scan's paths are checked where it is made. A path
with an extension a scan does not read, or an HTTP URL with a query string,
raises the error (class and message)
collect()raised. A path that is not a string, apathlib.Pathor a list or tuple of them raisesTypeError(#216). sample(n)without a seed is documented as deterministic: it draws with a fixed default seed, so it keeps the same rows on every call and every run. Pass a differentseedfor a different draw. Results are unchanged (#216).-
A
pathlib.Pathworks as a scan path. It raisedNotImplementedErroratcollect()(#216). -
Behaviour change:
group_bykeys,distinct,n_uniqueand join keys compare floats in the total order filters andsort()use:-0.0equals0.0, every NaN equals every NaN whatever its sign and payload, and NaN joins NaN. They compared raw bits, so the same column grouped one way and filtered another. This covers top-levelfloat16,float32,float64and dictionary-of-float columns, every joinhow(including right/outer key coalescing, where a right key fits the left type in total order:-0.0fits an integer key as0) and engine frames. A float nested in a struct or list column still compares by its bits. Nulls are unchanged: one group ingroup_byanddistinct, and never a join match. A group or distinct row shows its first row's value, matching first-appearance row order; a joined row keeps its own key value, and an aggregate over a key column folds the original values. Withk = [-0.0, 0.0, NaN, -NaN, null](-NaNis what0/0gives on x86),v = [1, 2, 3, 4, 5]:
| call | before | after |
|---|---|---|
group_by("k").agg(s=col("v").sum()) |
-0.0: 1, 0.0: 2, NaN: 3, -NaN: 4, null: 5 |
-0.0: 3, NaN: 7, null: 5 |
select("k").distinct() |
5 rows | -0.0, NaN, null |
group_by(...).agg(u=col("k").n_unique()) |
4 | 2 |
join(other, on="k"), other.k = [0.0, NaN] |
0.0 and NaN match once each |
-0.0 and 0.0 match 0.0, NaN and -NaN match NaN |
Results without a -0.0 or a NaN other than the positive quiet one are
unchanged, byte for byte. The key is canonicalized once, as a hidden copy,
before anything hashes it, so the parallel order-preserving partition (#212)
and the exact float folds are unchanged (#215).
- Behaviour change: error messages no longer show the engine's internals
(#214). A message names the step or argument, says what was wrong and what to
do; no message contains DataFusion's ?table? qualifier, a private
__ursa_ column, serde's or pyo3's wording, or a DataFusion/Arrow variant
prefix (Execution error:, Arrow error:, Error during planning:,
This feature is not implemented:, Schema error:). Where Ursa rewords an
engine error, the engine's text is the exception's __cause__ (a
RuntimeError); in Rust, PlanError::source() returns it. Every exception
class is unchanged, and so is every result. The messages that changed (old →
new; … is the rest of the new message):
- comparisons: Function 'greater' has no kernel matching input types
(string, int64) → cannot compare string with int64 (string > int64);
compare values of one type (every operator and type pair), and Integer
value N not in range: LO to HI → the integer N does not fit the type both
sides are compared as (range LO to HI), so the comparison would not be
exact; …;
- DataFusion's planning errors: Error during planning: Cannot coerce
arithmetic expression Utf8 * Int64 to valid types → cannot apply '*' to
string and int64 (string * int64); arithmetic needs numeric operands;
… logical boolean operation Boolean AND Int64 → '&' combines boolean
predicates (comparisons such as ur.col('a') > 1); got bool and int64 (and
'|'); … Int64 IS DISTINCT FROM Boolean (from ~) → '~' negates a
boolean predicate …; got int64; Function 'sum' failed to match any
signature, errors: … → sum() needs a numeric column, and got a string
column; sum() and mean() take numbers only, while min(), max(), count()
and n_unique() take strings too (and mean(), with the column's type;
another aggregation reads <fn>() cannot aggregate a <type> column);
Cannot get result type for temporal operation Timestamp(µs) *
Timestamp(µs): … → cannot apply '*' to timestamp[us] and timestamp[us]
(…); this arithmetic is not defined for these types; type names in these
messages are pyarrow's (dictionary<values=string, …>, decimal128(10,
2), timestamp[us]), never DataFusion's (Dictionary(Int32, Utf8));
Physical plan does not support
logical expression AggregateFunction(…) (an aggregation in a weight) →
an aggregation (.sum(), .mean(), ...) is not allowed here; …;
- Arrow errors: Arrow error: Divide by zero error → division by zero in an
integer expression; …; Arrow error: Cast error: Cannot cast string 'a' to
value of Int64 type → for join keys, join(on=): the left and right keys
have different types (the string 'a' cannot be read as int64); cast one
side's key to the other's type first, and for a graph column over a frame
whose ids are of another type, with_columns(): the frame's id column and
the graph's node ids have different types (…); build the frame with ids of
the graph's id type; join(on=): key 'k' keeps the left frame's type
(Int64), which can't hold every value of the right frame's key (Utf8); …
names the types int64 and string; Arrow error: Invalid argument error: must
either specify a row count or at least one column → select() needs at
least one column;
- schema errors: Schema error: No field named x. Valid fields are
"?table?".a, … → unknown column 'x'; the frame has ['a', …]., and
Schema error: Schema contains duplicate qualified field name "?table?".a
(a graph column named like an existing one) → the result would have two
columns named 'a'; …;
- graph verb arguments: Execution error: invalid columns spec: invalid type:
string "x", expected f64 → pagerank(damping=) must be a number; got 'x',
and … invalid value: integer -1, expected u32 → pagerank(max_iter=)
must be a non-negative integer below 2**32; got -1 (every parameter of
every verb); ValueError: invalid plan: a plan argument is NaN, which has no
JSON form → pagerank(damping=) must be a finite number; got NaN;
This feature is not implemented: direction must be 'out', 'in', or 'both';
got "x" → degree(direction='x') is not supported; use one of 'out', 'in',
'both' (also closeness, neighbors().agg, hop, shortest_path);
weight expression must be numeric; it produced a column of type Utf8 →
… of type string; weight expression references unknown edge column(s):
['x'] gains ; the edges have [...];
- integer arguments: argument 'n': 'str' object cannot be interpreted as an
integer → hop(n=) must be an integer; got a str, out of range integral
type conversion attempted → hop(n=) must be a non-negative integer; got
-1 or hop(n=) is too large; it must be below 2**32, can't convert
negative int to unsigned → random_walk(seed=) must be a non-negative
integer; got -1, int too big to convert → … is too large; it must be
below 2**64 (also random_walk(steps=) and walks_per_node=);
head("x")/sample("x"): invalid literal for int() with base 10: 'x'
→ head(n=) takes an integer row count; got 'x' (str); sample(-1):
Sample larger than population or is negative → sample(n=) must be a
non-negative row count; got -1;
- plan arguments: ValueError: invalid plan: invalid type: integer 1,
expected a string → join(how=) must be a string; got 1 (also
hop(direction=), shortest_path(direction=), describe(direction=));
rename({"a": 1}) → a rename() column name must be a string; got 1;
a plan argument of a type with no JSON form, TypeError: Object of type X is
not JSON serializable → <argument> cannot take a value of type 'X' (as
pagerank(damping=) cannot take a value of type 'object'), with the
original exception as its __cause__; rename(["a"])/rename(None) → rename() takes a
dict of {old: new} column names; got …; TypeError: Object of type X is
not JSON serializable (a filter literal) → a literal of type 'X' is not
supported in a filter expression; use a bool, int, float, str or None, …;
- frames and edges: AttributeError: 'str' object has no attribute 'kind'
→ filter() takes an ursa expression, such as ur.col('x') or
ur.col('x') > 1; got 'age' (str) (also weight=); 'NodeFrame' object has
no attribute 'nodes' / 'int' object has no attribute '_node' → a
TypeError that names the function, what it got and what to pass (every
verb, traversal and stat; see the edge-frame entry under Changed, #223);
cannot pickle 'ursa._ursa.PlanNode'
object → EdgeFrame objects cannot be pickled or deep-copied: a frame is a
lazy plan over live data. …; argument 'src': 'int' object is not an
instance of 'str' → src= must be a column name (a str); got 1 (int)
(scan_edges(src=) for a scan; id= raised expected bytes, int found);
KeyError: 'Field "x" does not exist in schema' → src column 'x' is not
in the table; it has [...]; argument 'storage_options': … →
storage_options= must be a dict of option names to string values; got …;
- seeds of another id type: src and dst node-id columns must have the same
type (both int64 or both string) → the node ids given are string but the
graph's node ids are int64; pass ids of the graph's id type;
- unsupported shapes, now raised where the step is added: collect() does not
yet support the 'with_columns' step on an edge frame. → with_columns() of
a graph verb is not supported on an edge frame; graph columns belong on the
node frame: edges.nodes().with_columns(...).; … step after a
random_walk. → with_columns() after random_walk() is not supported yet;
collect() the walk and build a new frame from it with ur.from_arrow(...)
first.; … step after describe(). → with_columns() after describe() …;
… step in a composed pipeline. → <step>() is not supported at this point
in the pipeline yet; …; select(col("x").sum()) named with_columns()
and now names select() (and sort());
- scans, now led by the scan and its path (scan_edges('edges.parquet'):
…): Error during planning: No files found at file:///…. Cannot infer
schema … → no file matches the path; check it (a glob must match at
least one file); Execution error: scan_edges: endpoint column "x" not
found in edge file "…" and Schema error: No field named x … → src
column 'x' not found in the file; it has [...] (id column for
scan_nodes); Parquet error: Parquet error: Invalid Parquet file. Corrupt
footer → the file is not valid Parquet (corrupt footer); Error when
processing CSV file …\ncaused by\nObject Store error: Generic
LineDelimiter error: … → could not read the file as CSV: …; This
feature is not implemented: scan_edges supports .parquet and .csv in v0.1;
got path "…" → only .parquet and .csv files can be scanned; …;
scan: unsupported URL scheme "ftp" (…) → unsupported URL scheme 'ftp';
use a local path or a file://, …; edge source "…" resolved but contained
no rows; … → the file has no rows; …;
- more scan and storage messages: src and dst node-id columns must be the
same type (both int or both string); got Int64 and Utf8 in "…" → the src
and dst columns must have one id type (both integer or both string); got
int64 and string; node ids must be an integer or string column; Float64
is not a supported id type → node ids must be an integer or string
column; got double (and unsupported node-id type …; node ids must be
int64 or string (Utf8) → node ids must be an integer or string column;
got …); scan: bad object-store url: … → not a valid URL: …; the http
query-string message loses its scan_edges: prefix and trailing got
"…" (the label names the scan and its path); object_store's Generic HTTP
error: Error performing HEAD <url> in …, after 10 retries, … - HTTP error:
<cause> → could not read <url>: <cause>, Configuration key: 'k' is not
valid for store 'S3'. → storage_options key 'k' is not an option of the
S3 store; …, and other Generic S3 error: … messages lose that prefix;
- classes: every class is as before, with one fix: an engine error is a
ColumnNotFoundError by its structure (a schema error, or Ursa's own
"column … not found"), so a storage error whose path holds the word
"column" (s3://b/columns/x.parquet not found) is now the ComputeError
it is. An exception that is a subclass (UnicodeEncodeError for a string
with no UTF-8 form) is raised as it is, and a reworded exception keeps the
one it replaced as its __cause__;
- the stats as plan nodes (#217): a sample= or approximate= of the wrong
type, argument 'sample': 'str' object cannot be converted to 'PyFloat'
→ avg_path_length(sample=) must be a number or None; got 'x' (str), and
diameter(approximate=) must be a bool; got 'x' (str). #217's own
messages (bool(expr)'s TypeError, describe(nodes=...), the stats'
direction=, steps after a stat or on a bare nodes()) were already in
this form and are pinned by the tests;
- Ursa's own messages lose the variant prefix DataFusion put before them
(Execution error: output column name 'id' is reserved …, This feature is
not implemented: neighbors().agg() needs a node attribute table …, and
the rest of the weight expression … and neighbors().agg() … family);
- the scan messages #216 adds, in the same form (pinned in
tests/test_error_messages.py): a list of paths is labelled with the list
(scan_edges(['a.csv', 'b.csv']): the paths in a list are read as one
table, so each needs the same columns, with the same types, in the same
order. Column 'w' is int64 in 'a.csv' and double in 'b.csv'. Write the
files with matching types …, and … 'a.parquet' has the columns [s, d, w]
and 'b.parquet' has [s, d]. Give every file the same columns …; … the
paths in a list must be on one store …), the CSV options name the call
(scan_edges(): delimiter must be one ASCII character; got ';;'. Pass a
single character, such as ';'., read_edges(): the CSV options
(null_value=) only apply to .csv files, …), and an unknown keyword names
the function and the option to use (read_edges() got an unexpected
keyword argument 'sep'; use delimiter= instead.). A stack too small for a
plan raises UrsaError: collect(): the frame's plan has N relational
steps, more than the 65280 one plan can run. …;
- a CSV value that does not parse as its column's inferred type (#222):
scan_edges('g.csv'): Parser error: Error while parsing value 'yes' as
type 'Boolean' for column 2 at line 1001. Row data: '[2,3,yes]' →
scan_edges('g.csv'): column 'f' was inferred as bool from the first 1000
rows, but line 1002 has 'yes', which is not a valid bool. Fix the value,
pass null_value='yes' if it marks a missing value, or read the file with
pyarrow.csv (column_types=) and pass the table to ur.from_arrow(). The
message names the column, its type in pyarrow's spelling (bool,
int64, double, date32[day], timestamp[s], ...), the value, and
the value's line in the file, counted from 1 with the header as line 1.
arrow-csv counted from 0, and from the start of each byte range when
DataFusion split a large file across cores, so its line depended on the
core count. Ursa now reads the failing column again, file by file in path
order, and reports the first value that does not parse. The value and
line are the same on any core count, and the message is the same with or
without null_value. A glob or a list of paths also names the file
(line 9 of 'data/b.csv'). When the engine's text for a timestamp has no
value, the message says has a value that is not a valid timestamp[s].
The class is ComputeError, as before, and the engine's text is the
__cause__.
- Behaviour change: a standalone graph verb is a full NodeFrame (#213).
ur.degree(e), ur.pagerank(e) and the other node-valued verbs called on
their own are edges.nodes().with_columns(<verb>=...) with every frame
method: join, group_by, rename, sample and limit now work (they
raised AttributeError: 'GraphExpr' object has no attribute 'join'), and
isinstance(ur.degree(e), ur.NodeFrame) is true, so a verb is also a
join's right side and a seed set. The methods return a plain NodeFrame.
Inside with_columns(...) a verb is still an expression and builds no frame
of its own; its repr and operators are unchanged.
- Behaviour change: edges.nodes() with no columns collects to its node
set: one id column, the rows with_columns(degree=ur.degree(edges)) has in
the same order (the parent graph's nodes over a filtered frame, the nodes of
the rows after a reshaping step). Relational steps and joins after it run on
those rows, and a join whose right side is a bare nodes() now builds. It
raised NotImplementedError: collect() on this NodeFrame needs a source ...
(#213). A first with_columns of scalar expressions runs on that node set
too (e.nodes().with_columns(y=ur.col("id") + 1)), as do the steps before
and after it. Over a filtered frame or a traversal result the node set is
the parent graph's (ur.hop(e, 1).from_([0]).nodes() has every node), as
degree and describe read it; describe(f, nodes="touched") counts the
touched ones. The row is gone from docs/limits.md.
- Behaviour change: an ursa expression has no truth value. bool(expr)
raises TypeError: the truth value of an ursa expression is ambiguous ...,
as Polars does, so if ur.col("a") == 1:, ur.degree(e) in frames and
a and b over expressions fail instead of always passing. == still builds
an expression; combine predicates with &, | and ~ (#213).
- ur.density, ur.avg_path_length and ur.diameter run as plan nodes, as
describe does (Plan::Stat). ursa._ursa.graph_density,
graph_avg_path_length, graph_diameter and PlanNode.graph_index are gone.
Over a whole graph or a reshaped edge set the values are byte-identical.
- Frames hold Rust plan objects (#193, the last item of #189). An EdgeFrame
or NodeFrame holds one ursa._ursa.PlanNode, as a Polars LazyFrame holds
its plan: each method converts its arguments, calls into Rust, which builds
and validates the next step (ursa_plan::lazy, ursa_plan::infer), and wraps
the new node in a frame of the same type. collect(), schema() and
explain() run there, and so do the caches: a frame's topology index (with
its weights, masks and symmetric views) and a scanned node table live on the
Rust state a frame shares with the derivations that keep its rows, so a
derivation made before a build still sees it. Python keeps the API surface,
input conversion (pandas/polars/numpy/lists to Arrow, expressions and
arguments to the plan IR), interop egress and the datasets, plus four small
callbacks (ursa._execute): a seed iterable's conversion, the stdlib's
seeded draw for sample, the on_null="drop" warning and an in-memory
table's identity token. Nothing in Python lists the engine's steps, verbs,
aggregations, joins, directions or modes any more; a test fails if a module
does. ursa._ursa.run_plan, resolve_index and scan_build_index are gone.
Results are byte-identical: three parity harnesses (10,928 plans) give the
same schema, values (floats by their bits), row order and errors as before,
on one core and on four. Building a step, its validation included, takes
about 8 µs (2.3 µs before, when nothing was checked), however long the chain
before it and however wide the frame: a check reads its input's results, and
a frame joined with itself is checked once per side, not once per path. A
20-step pipeline on karate builds and collects in 5.8 ms, as before, and a
small collect is 0.18 ms against 0.21 ms (4 cores, medians of 5 interleaved
runs). A frame drops its chain a step at a time, so a long one drops on a
small thread stack.
- Behaviour change: a step that cannot run raises on the line that adds it,
not at collect(). The exception class and message are the ones collect()
raised. What moved:
- an unknown column in filter, select, with_columns, rename, sort,
group_by or agg (ColumnNotFoundError: sort() references unknown column
'x'; the frame has [...]), a join key missing from either side, the node
id column a graph column attaches by, a weight's edge column, and an edge
frame whose steps dropped src or dst under a graph op;
- two output columns with one name (select, rename, a join's non-key
columns), and a graph column named id;
- a filter that is not a boolean predicate, an operator or expression node a
filter does not take, a role (ur.src(), ur.dst(), ur.id()) the frame
does not have, and a comparison between types that do not compare
(ComputeError: ... has no kernel matching input types (string, int64), or
the ValueError for an aware against a naive timestamp);
- every unsupported shape (NotImplementedError): a step after describe()
or a random_walk other than a relational step or a join, a graph verb in
an edge frame's with_columns, reverse() after a traversal, a traversal of
a traversal result, a step between a traversal and a graph op over it, a
with_columns after another step on edges.nodes(), an unknown how, a
graph verb's unsupported mode=, dtype=, weight= or neighbors() form,
and a join whose right side does not collect;
- an argument the step could not take: sort([]), a descending list of the
wrong length, a select item that is not an expression, group_by keys or
aggregations of the wrong form, join(on=None), a non-integer head(n) or
sample(n), a non-frame join(other), and a literal with no JSON form.
These stay at collect(), since only the rows (or the files) tell: a null
endpoint, an integer divide by zero, a value out of range, a right or outer
join key the left type cannot hold, a missing or empty file, a scan's columns
(the file is read then, and may change in between), store=, a scan of
several files, and an invalid graph verb parameter value. When a
plan has a step the plan alone shows is wrong and also an error only the rows
show earlier in it, the step's error is now the one raised. A step on an edge
frame is checked even where a later use reads only the frame's topology:
ur.degree(e.select("s", "d", "nope")) and
e.filter(ur.col("nope") > 1).nodes() used to run, skipping the step, and
now raise where the step is added. One message reads differently: a NaN or
infinite graph-verb parameter raises ValueError: invalid plan: a plan
argument is NaN, which has no JSON form (it quoted a JSON parser offset).
The guard on steps on a traversal's edges before nodes() is raised by the
first with_columns after nodes(), which raises the graph op's own guard
instead when its edges are those, as collect() did. Two other errors read differently. A role column that is not a string
(scan_edges(path, src=1, dst="d")) raises TypeError: argument 'src': 'int'
object is not an instance of 'str' where the frame is made (collect()
raised ValueError: invalid plan: invalid type: integer \1`, expected a
string). An argument the plan could not read keeps that message but no longer
ends with the JSON parser'sat line 1 column N.
-collect()now hands the whole query to Rust as one plan. The frame is
serialized to a plan IR inursa-plan(ursa_plan::plan::Plan), and a single
entry point,execute_plan(ursa._ursa.run_planin Python), picks which
executor runs it and rejects unsupported shapes, with the same error messages
as before. The Python layer no longer decides which of the engine's seven entry
points to call. Results are unchanged. Caches, subgraph masks, plain-source
reads and the steps the engine's tail can't run in written order still run in
Python, called back from the executor as it needs them.run_node_query,run_join_query,run_hop_query,run_path_query,run_walk_queryandgraph_describeare gone fromursa._ursa.ursa-plangains plan
conformance tests: JSON plans over karate and other small graphs, with
expected output recorded from the Python package (#190, part of #189).
- One expression evaluator: everyfilternow runs in Rust through the same
DataFusion lowering, wherever it sits. Before,pyarrow.computeevaluated
filters on plain frames, subgraph-view masks and steps after the engine's
tail. Subgraph masks are built in Rust, in dense id space; a traversal
result's mask comes straight from the reached node set. Plain sources are
DataFusion scans:scan_edges(...).filter(...)pushes its leading filters
into the read, so Parquet skips row groups whose statistics rule them out.
Masks are cached on the graph index, keyed by the view, so two frames with
the same filter share one. Ascan_nodesframe keeps one table, the union
of the columns read so far, instead of one table per projection (#178).
Results are unchanged, except for NaN (next entry) (#192, part of #189). On 10M
edges (4 cores): the first maskeddegreeover a scan, 0.24s to 0.11s; the
mask of a 2-hop traversal result from 2,000 seeds, 0.92s to 0.24s; a
1%-selective filter on a 10M-row Parquet file sorted by the filtered column,
0.12s to 0.010s.
- **Behaviour change:** NaN compares in total order in every filter: NaN equals
NaN and is greater than every number, as insort(). Filters inside an
engine query already did; filters on plain frames, subgraph masks and steps
after the engine's tail compared IEEE-style (any comparison with NaN false,!=true). Withf = [0.5, NaN, null, 2.0, -1.0]`, a plain frame keeps:
| filter | before | after |
|---|---|---|
f > 1 |
2.0 |
NaN, 2.0 |
~(f > 1) |
0.5, NaN, -1.0 |
0.5, -1.0 |
f == nan |
none | NaN |
f != nan |
0.5, NaN, 2.0, -1.0 |
0.5, 2.0, -1.0 |
f != f |
NaN |
none |
f / 0 > 1 |
0.5, 2.0 |
0.5, NaN, 2.0 |
Nulls are unchanged: a comparison with null is null, and the row is dropped
(#199).
- Filters inside an engine query (after graph columns, a join or a traversal)
accept every literal a plain-frame filter does: datetimes, dates, times,
timedeltas, numpy.datetime64/timedelta64 (a unit of a day or finer),
Decimal (up to 76 digits), bytes, NaN, infinity and None. They used to
raise TypeError: Object of type ... is not JSON serializable (or
ComputeError for NaN and infinity, "unsupported literal type" for None).
A day-unit numpy.datetime64 now works on plain frames too (it raised a
TypeError); a month or year unit raises a TypeError that says so (#192).
- Every filter compares the way plain frames did: operand types pyarrow had no
comparison kernel for stay errors, timestamps, durations and times compare
at the finer unit, an integer past 253 against a float and a uint64 past
263 against a signed integer stay "not in range" errors. Engine filters
used DataFusion's coercion, which parsed ur.col("n") == "1" as a number and
compared timestamps at the coarser unit (#192).
- Such errors are ursa.ComputeError on every path. Plain frames and subgraph
masks used to raise pyarrow's exceptions: ArrowNotImplementedError (a
NotImplementedError subclass) for a type mismatch such as
ur.col("n") == "x", and ArrowInvalid (a ValueError subclass) for an
integer divide by zero or a value "not in range". The engine already raised
ComputeError. A timezone-aware against a naive timestamp of the same unit
stays a ValueError (#192).
- A string_view column compares with a string literal; pyarrow had no kernel
for it (#192).
- ursa._ursa no longer has hop_reached_nodes_query,
shortest_path_nodes_query, scan_edges_arrow, scan_edges_table_arrow or
scan_nodes_arrow; the plan reads and masks itself (#192).
- Behaviour change: louvain partitions differ from 0.4.1 for the same
seed. Local moving now revisits only the neighbours of nodes that moved, and a
level stops when a sweep's worth of work gains less than 1e-7 modularity (with
a hard cap of 64 sweeps' worth), instead of sweeping until no node moves.
Modularity is equal or higher on most graphs; results stay deterministic for a
given seed and identical on any thread count. Louvain is now near-linear in
graph size: 1M edges takes 2.2s, down from about 6 minutes (#125, #185).
- Faster and leaner; outputs are byte-identical unless noted. Timings on a
4-core machine:
- Repeated weighted collects over a scan_edges frame no longer rescan the
file and rebuild the index. The evaluated weight= vector is cached on the
index (up to two expressions), so a repeat skips the read entirely: weighted
PageRank over a 10M-edge scan, 2.2s to 1.4s, and peak memory 1.0 to 0.68 GB
(#179).
- direction="both" builds its symmetric graph once per index, straight from
the cached undirected adjacency, and it is its own transpose; the weighted
view is built flat and shared within a query. PageRank with
direction="both" on 10M edges: 0.91s to 0.34s; weighted, 4.3s to 1.4s and
1.9 to 1.2 GB peak (#180).
- A filtered or traversal-result edge frame computes its edge mask once and
reuses it on later collects: a repeated masked degree over a 10M-edge scan,
0.19s to 0.03s (#181).
- Graph columns on a node attribute frame are attached by a dense-id gather
instead of a hash join and a re-sort into table order: degree onto a
1M-node table, 0.10s to 0.02s (#182). A float group_by().agg(mean) over
such a frame now sums in table order; it previously followed the join's
emit order, which varied in the last bits between runs.
- Queries and scans reuse their DataFusion session, and scans of one object
store with the same storage_options reuse one client and its connection
pool. Local Parquet footers and statistics are cached across collects and
revalidated by size and modification time, so a file rewritten in place is
read afresh (#183).
- Weighted closeness sums only the nodes each source reaches, so sparse
graphs no longer pay O(n²): 80k nodes, 1.27s to 0.23s. avg_path_length
and diameter reuse per-thread BFS scratch: about 12× faster on sparse
graphs. Betweenness reduces its partial sums in bounded windows, so exact
runs no longer hold O(sources/64 × n) memory; small samples run their
sources in parallel, and unweighted Brandes reads predecessors from the
in-adjacency (#184).
- Building the index over compact integer ids (0..n, or any dense range, in
any order) interns through a direct table instead of a hash map: about 1.4×
faster in memory and up to 1.7× from a Parquet scan, with a smaller id map.
Sparse ids switch to the hash map automatically. Id lookups over columns with
no nulls skip per-row null checks (#186).
- Every relational step now runs in the engine, lowered to one DataFusion plan
in the order written:
filter,select,with_columns,rename,sort,head,distinct,sampleandgroup_by().agg(), on any frame. Before, the engine ran a fixed-order tail of them (filter → group_by → distinct → sample → sort → head → rename) and pyarrow ran whatever didn't fit, after the engine returned. The order guarantees (unsorted output in input order, stable sorts,distinctandgroup_byat first occurrence,samplein input order) are implemented once, and cost an ordinal only above an operator that reorders rows (#191, part of #189). This lifts these limits: - two
with_columnssteps in one plan, andwith_columnsafter any other step: it computes over the rows and columns the steps before it leave, and an algorithm's column attaches to them by the node id column; with_columnsof expressions other than graph verbs, such aswith_columns(v2=ur.col("v") * 2); a keyword naming an existing column replaces it in place;- a tail (
filter,sort,head, ...) afterdescribe(); sortby an expression, such assort(ur.col("v") * -1);selectof an expression, named by its.alias()or else its first column.
On a 1M-node graph (4 cores, medians of 6 interleaved runs): a filter after
an algorithm, 6.8 ms to 5.7 ms; a head, 2.3 ms to 2.5 ms (within noise); a
filter + group_by (a count, a float sum and a float max) + sort tail over
a 1M-row attribute frame, 26 ms to 39 ms. The float aggregations now fold each
group's values in input order, as a plain frame always has, which keeps every
bit of a sum reproducible but runs them less in parallel.
- Joins run in the engine, anywhere in a plan (#191, part 2 of 3, part of
#189). The right side of a join is built like any frame, with its steps
lowered, instead of being executed as a separate plan; both sides are put in
order, numbered and joined in one DataFusion plan, and the steps after the
join lower onto it. This lifts these limits:
- any number of join steps in one plan (a.join(b).join(c)), before or
after any other step, with_columns included;
- join on a traversal result (hop, shortest_path), after a
random_walk, and after describe(), on either side of the join;
- a right side that is any frame: a graph column, an algorithm result, a
traversal or another join.
how takes "right", "outer" (also spelled "full", Polars' name),
"semi" and "anti" as well as "inner" and "left". The output is the
left frame's columns, then the right frame's non-key columns (none for
semi/anti); each key appears once, holding the right key on a row only the
right frame has, with the left key's type for every how (a right or
outer join whose right key holds a value that type can't raises a
ValueError). Null keys never match. The row order is fixed:
- inner, left, semi, anti: the left rows in order, each followed by
its matches in right-frame order (as before for inner and left);
- right: the mirror image, the right rows in order, each followed by its
matches in left-frame order;
- outer: left's order, then the unmatched right rows in right-frame
order.
An unknown how now says which are supported: join how='cross' is not
supported (use ['anti', 'full', 'inner', 'left', 'outer', 'right', 'semi']).
On a 4-core machine (medians of 6 interleaved runs): a plain join of two
1M-row tables, 71 ms to 68 ms (within noise); a 1M-row attribute frame
joined to a degree result, 74 ms to 73 ms. A two-join pipeline over them
runs as one plan in 98 ms, against 115 ms as two collects with the first
result re-ingested, the only way to write it before.
- Graph ops run over reshaped edge sets (#191, part 3 of 3, part of #189). A
graph algorithm, traversal, random_walk or describe over an edge frame
after distinct, sample, join, group_by().agg(), sort or head runs
over the graph of that frame's rows: exactly what collecting the rows and
building a new frame with ur.from_arrow(...) gives, node order and row
order included. For example ur.pagerank(e.group_by("s", "d").agg(w=ur.col("w").sum()),
weight=ur.col("w")), ur.degree(e.join(allowed, on="s", how="semi")) or
ur.hop(e.distinct(), 2).from_([0]). A filter written after the reshaping
step is a subgraph view of the reshaped graph, as on any edge frame;
select, rename and with_columns keep the rows, so a weight or filter
after them reads the columns they leave. The edges must keep their src and
dst columns; a step that drops one raises ColumnNotFoundError naming the
step (a rename does not move a role).
The topology of a reshaped edge set is cached for the session under a
fingerprint of its edge plan: the plan as written, an in-memory table's
identity, and a local file's size and modification time (a rewritten file is
read again). Repeated collects reuse it, with its weight, mask and
symmetric-view caches, as a source frame's index is reused (#179). The cache
holds four topologies, least recently used evicted, each a whole graph index
with its weights and masks, for the life of the process; a plan over a
remote file, or a sample whose seed has no exact JSON form (bytes, an int
past 64 bits, a non-finite float), builds its topology on every collect. This lifts these limits:
- a graph algorithm over a distinct, sample, join or group_by result;
- a step other than filter on an EdgeFrame before nodes():
e.head(100).nodes() has the node set of those rows;
- graph columns over different edge frames in one with_columns
(nodes.with_columns(pr=ur.pagerank(e), d=ur.degree(e.filter(...)))). Each
edge frame's columns attach to the frame's rows by node id, as an attribute
frame's always have; a node another graph lacks gets null there. On
edges.nodes() the first graph column's edges give the node set (or the
reshaped edges nodes() was called on);
- with_columns of scalar expressions on an EdgeFrame.
On a 4-core machine (medians of 5 interleaved runs): weighted pagerank over a
10M-edge frame aggregated by group_by("s", "d") takes 6.0s on its first
collect and 1.7s repeated, against 6.2s for collecting the aggregate and
re-ingesting it every time. A with_columns of pagerank over 10M edges and
degree over a filtered view of them, on a 1M-row attribute frame, takes 0.25s
in one collect against 0.27s as two.
- Behaviour change: a graph op over an edge frame whose select, rename
or group_by dropped its src or dst column raises ColumnNotFoundError:
a graph op needs the edge frame's src column 's', but rename() renamed it to
'a'; a rename does not move the src role, .... A traversal, random_walk or
describe over such a frame used to ignore the step (#191).
- Behaviour change: a step behaves the same wherever it runs. Before, the
same step could give different results on a frame the engine ran (after a
graph algorithm, a traversal or a join) than on a plain frame, depending on
where it fell in the fixed-order tail. Every step now has the plain frame's
semantics:
- sample(seed=) after a graph algorithm, join or group_by now picks the
same rows as on a plain frame; picks for a given seed differ from 0.4.x.
Rows are drawn with the stdlib's seeded generator over the row positions,
so any seed Python's random accepts works there too (a negative, string
or very large seed used to raise).
- group_by().agg() float sum, mean, min and max follow pyarrow's
rules on every frame: values are added in input order, min/max skip NaN
unless every value is NaN, and ties keep the first value. On an engine
frame max could return NaN, or a value that was not the maximum, when the
group had NaNs. An integer or boolean mean adds its values as floats in
input order too, so it gives the same bits on any number of cores.
- Every group_by().agg() output column is nullable, as on a plain frame (an
engine frame marked count, n_unique and keys that held no null as
non-nullable).
- An unknown column raises ColumnNotFoundError on every frame and every
step (filter, select, with_columns, rename, sort, group_by,
agg), with one message shape: sort() references unknown column 'x'; the
frame has ['a', 'b']. Before, the class depended on the step and the frame:
ValueError, ColumnNotFoundError or ComputeError, with differing
messages. ColumnNotFoundError now subclasses ValueError as well as
UrsaError, so except ValueError still catches it.
- head(n) with a negative n keeps no rows on every frame; an engine frame
raised OverflowError.
- A select or rename that would give two columns one name raises
ValueError before the plan runs: select() would produce duplicate column
'f'. A plain frame returned both columns (select("f", "f"), or
rename({"f": "g"}) when g exists).
- group_by().agg() with a float sum, mean, min or max (or an integer
or boolean mean) no longer reads its rows through one serial hash
repartition (#204). The rows are cut into fixed-size chunks, each chunk is
hash-partitioned by the group key in parallel, and every partition reads its
chunks' rows back in chunk order. Each group still folds its values in input
order, so results are unchanged, bit for bit, on any number of cores. On 10M
rows (4 cores, medians of 5 interleaved runs), before → after (the release
before #191 part 1 in brackets):
agg |
~1k groups | ~1M groups | one group holds half the rows |
|---|---|---|---|
float sum |
0.083s → 0.067s (0.100s) | 0.69s → 0.21s (0.46s) | 0.57s → 0.28s (0.43s) |
count + sum + max |
0.106s → 0.072s (0.108s) | 0.95s → 0.28s (0.64s) | 0.81s → 0.36s (0.61s) |
count alone |
unchanged, 0.027s | unchanged, 0.19s | unchanged, 0.20s |
PageRank over edges grouped by (s, d) with a float sum (10M edges), 3.96s
to 2.08s, with peak memory 2.29 GB to 1.71 GB. The filter + group_by +
sort tail over a 1M-row attribute frame, 23 ms to 22 ms (17 ms before #191
part 1): its ~50 groups spread over 4 partitions only as evenly as they hash.
Fixed¶
- Behaviour change: a CSV column of numbers whose first 1,000 rows hold a
float spelling that arrow-csv's type inference reads as text (
+5,+.5,Inf,-nan,NAN,Infinityand the other cases and signs ofnan,infandinfinity) isdouble, as pyarrow reads it. It wasstring(even its1.5s), so a weight column with one such value failed in a weighted algorithm with a type error. Each value parses to pyarrow's bits:+5is5.0,-nankeeps its sign.1e400(inf),-0next to a float (-0.0),nan,infand-infalready read as pyarrow reads them. A column of integers only, or with any other text in it, keeps its type, and so does every column without such a spelling. This holds with and without anull_value.nanstill reads as NaN, as before; pyarrow's default options read it as null. Passnull_value="nan"to read it as null. A scan whose sample has a column of text reads that sample a second time, to check its spellings (#221). -
Long chains no longer crash the process (#216).
ur.degreeover 20,000 chained filters segfaulted on the default stack (a recursive clone of the plan), and collecting a 20,000-step chain segfaulted on a 256 KB thread stack (a recursive drop). A plan's inputs are now shared, so cloning a plan copies one step, and dropped a step at a time; the reshaped-topology fingerprint walks the chain in a loop; plan (de)serialization andDebugmove onto a heap-allocated stack segment when the thread's runs low. A frame with more than 64 relational steps runs itscollect(),schema(),explain()and graph index build on a stack sized to it, since DataFusion's optimizer and planner recurse once per operator: a node frame filtered 10,000 times after a graph column segfaulted on the default stack there. Plans of up to 64 steps run as before; the stack a plan may reserve is capped at 1 GiB (about 65,000 relational steps), past whichcollect(),schema()andexplain()raiseUrsaErrornaming the limit and saying to collect part of the chain first.collect(),schema(),explain()and graph ops over 20,000-step chains now work on a 256 KB thread stack. -
Behaviour change:
ur.density,ur.diameterandur.avg_path_lengthover a filtered edge frame or ahop/shortest_pathresult read its subgraph view, asdescribeand every graph op do (#210). They used to compute over the whole parent graph, ignoring the filter: on the issue's reprour.density(f)was 0.333 (now 0.1667),ur.diameter(f, approximate=False)2 (now 1) andur.avg_path_length(f)1.333 (now 1.0). The view is the parent's node set and only the kept edges, sour.density(f) == ur.describe(f).collect()["density"][0], and an exact path stat equals its value over a new frame of the kept rows. A sampled estimate (avg_path_length(sample=), the default approximatediameter) picks its sources among the nodes at an end of a kept edge. Since the view's filter now runs, an error only the filter's rows show (an integer divide by zero) is raised by the stat too. group_by()by a dictionary (categorical) column withint8,int16,uint8oruint16codes, anddistinct()over one, raised "Dictionary key bigger than the key type" when the result had more groups than the codes index: a key whose batches carry dictionaries of their own, or a second key that multiplies the groups. The aggregate now indexes such a key withint32codes and the result narrows them back to the column's type when its values fit; a result with more distinct values than the type indexes keepsint32codes.describe()over a filtered edge frame reported the unfiltered graph: every edge was counted, whiledegree()over the same frame read the filter as a subgraph view. It now reads the same view: the parent's node set, and only the kept edges forn_edges,density,avg_degreeandn_components. A traversal result is described as the subgraph its reached nodes induce, and a filter above a reshaping step (e.distinct().filter(p)) masks the reshaped rows' graph. Fors = [0, 0, 1, 2],d = [1, 2, 2, 3],w = [0.1, 0.9, 0.9, 0.1],ur.describe(e.filter(ur.col("w") > 0.5))wasn_nodes=4, n_edges=4, density=0.333, avg_degree=1.0and is nown_nodes=4, n_edges=2, density=0.167, avg_degree=0.5(#207). As withdegree, the node set stays the parent graph's. So over a traversal resultn_nodesis the whole graph's, every unreached node is its own component, anddensitydivides by the parent's node count. A 10-node neighbourhood of a large graph has a density near 0.- A Parquet scan could read a column as a single repeated value. With row
groups
[NaN, NaN]and[1.0], or one row group[NaN, 1.0, 1.0],ur.scan_edges(p, ...)read float columnras[1.0, 1.0, 1.0]; with string row groups["a", "a"]and two strings over 4 KiB, it read all four rows as"a". A weight, filter or graph op over the column saw the same wrong values;pq.read_tableand an in-memory frame read what was written, as the scan now does. Parquet statistics carry no min/max for an all-NaN float row group or a string past pyarrow's 4 KiB limit, and leave NaN out of float bounds. DataFusion 54 still marked the file's bounds exact, and read a column whose exact min equalled its exact max as that constant. Scans now keep a column's file-level min/max exact only when every row group backs them, and never for a float column: the bounds still prune, but no longer stand in for the values (#202). - A comparison on a dictionary-encoded float column (
ur.col("w") > 1on a categorical of floats, in memory or from Parquet) raised "Unsupported data type Dictionary(Int32, Float64) for function isnan". It now compares by value under the same total order as a plain float column (#199): NaN is above every number (#202). sort()orders floats as filters compare them (#201): every NaN is above every number whatever its sign bit, and-0.0equals0.0, so they tie and keep input order, dictionary-encoded float columns included. A NaN with the sign bit set, the usual result of0/0, used to sort before every number after a graph algorithm or a join. A descending sort now puts NaN first on every frame; a plain frame used to put it last in either direction. Nulls still come last. Forr = [1.0, NaN, None, 2.0],sort("r", descending=True)was2.0, 1.0, NaN, Noneon a plain frame and is nowNaN, 2.0, 1.0, None.- On a frame the engine ran (after a graph algorithm or a join), a second
distinct()over a dictionary-encoded (categorical) column could return duplicate rows (f.distinct().select("c").distinct()), and adistinct()aftergroup_by().agg()raised "Schema contains duplicate unqualified field name" (#191). hop,shortest_pathandrandom_walkover a filtered edge frame ignored the filter:ur.hop(e.filter(ur.col("w") > 5), 2)reached nodes through edges the filter removed. They now follow only the kept edges, and a graph op over such a traversal result (ur.degree(ur.hop(e.filter(...), 1).from_(s))) stays inside the filtered subgraph (#192).- A graph op over a traversal of a reshaped scan
(
ur.pagerank(ur.hop(ur.scan_edges(p).sample(100), 1).from_([1]))) ran over the whole file's index; it now runs over the sampled rows' graph, as the in-memory equivalent does (#190, #191). hop,shortest_path,random_walk,describeand a graph column on an attribute frame ignored asortorheadon their edges, and ran over the whole graph:ur.random_walk(e.head(3), ...)walked edgesheaddropped. They now run over the graph of the kept rows (#191). Asortalso changes the order rows come back in:ur.hop(e.sort("w"), 2)andur.shortest_path(e.sort("w"), ...)follow the sorted rows' node and edge order (as a frame built from those rows does), not the unsorted frame's.- The same graph ops ran over the original endpoints after a step that wrote
new values into the
srcordstcolumn:e.rename({"s": "d", "d": "s"})ore.with_columns(s=ur.col("s") + 10). They now read the endpoints from the rows the step leaves, as a frame built from those rows does (#191). - A weight, or a filter on the edges, read the source's column where a
with_columnson the edges had replaced it, or a columnselecthad dropped:ur.shortest_path(e.with_columns(w=ur.col("w") * 2), a, b, weight=ur.col("w"))used the originalw(#191). - Graph columns on a 0-row in-memory node frame return an empty frame with the table's columns plus the computed ones, instead of raising "No field named __ursa_gid" (#153, #182).
Security¶
- Bumped
rustls-webpki0.103.15 → 0.103.16 (RUSTSEC-2026-0382) andtokio1.53.1 → 1.54.1 (RUSTSEC-2026-0386). RUSTSEC-2026-0391/0398/0403/0410 inzstd0.13 are waived indeny.toml: the fixes need zstd 0.14, which arrow, parquet and DataFusion 54 do not accept yet, and none of the affected code is reached (#188).
0.4.1 — 2026-10-19¶
Fixed¶
- Unsorted output now has a fixed row order on the engine paths that had none:
an attribute frame with graph algorithms (
ur.from_arrow(attrs, id=...) .with_columns(pr=ur.pagerank(edges))) returns the attribute table's row order, andjoin()returns the left rows in order, each followed by its matches in right-frame order.group_by().agg()anddistinct()return rows in order of first appearance, andsample()keeps its picks in input order, on every path including plain frames.head(n)takes the firstnrows of that order. Before, the order changed with the number of CPUs (DataFusion's partition count) on large inputs (#168).
0.4.0 — 2026-10-18¶
Added¶
-
sort()takes several keys, Polars-style:sort(["club", "pagerank"], descending=[False, True])orsort("a", "b").descendingis one bool for every key or one per key; later keys break ties; nulls sort last for every key; dictionary-encoded keys sort by value. Works on plain, scanned and edge frames, grouped and joined results, graph-derived frames and traversal outputs (#163). The sort is stable on every path: rows that tie on every key keep their input order (#165). -
direction=ondensity,avg_path_length,diameter,describe,pagerank,closenessandbetweenness. The default stays"out", so existing results are unchanged.direction="both"reads the rows as a simple undirected graph: each pair of nodes joined in either direction is one edge, and self-loops are dropped. It matches NetworkX onG.to_undirected(): on Zachary's karate club, density 0.139,avg_path_length2.41 and diameter 5, against 0.0695, 1.27 and 3 with the default (#124).closenessalso takes"in";pagerankandbetweennessreject it. See Semantics vs NetworkX. join()andgroup_by().agg()now compose in one lazy pipeline, in either order, and run as written:join(...).group_by(k).agg(...)groups the joined rows, andgroup_by(k).agg(...).join(...)joins onto the grouped result. Previously this raisedNotImplementedErrorand needed twocollect()steps.from_networkx(..., symmetrize=)controls whether reverse rows are written.
Fixed¶
- A
sort()after a graph algorithm or traversal returned rows that tie on every key in an order that depended on the machine's core count, not in input order. Ties now keep their input order, as on a plain frame: node order (or the attribute table's row order) after a graph algorithm, and the traversal's own output order afterhop/shortest_path/random_walk(#165). select("c").distinct()kept duplicate rows on plain frames, becausedistinctran over every column beforeselectnarrowed them (#162). Other orderings that were silently reordered are fixed too:headbeforesort/filter/distinct/sample/joinnow takes the first rows as written, a rename that swaps two names no longer mislabels the columns, and twosorts on a graph-derived frame no longer drop the first.-
rename(...).sort(new_name)(andfilter/select/group_byon the new name) failed with "unknown column", because rename was applied last (#164). -
A plain
collect()on ascan_edgesframe returned only the endpoint columns, sofilter/sort/select/group_byon any other edge column failed with "unknown column", andsink_parquet/sink_csvwrote endpoints only. A scanned edge frame now has every column of the file, in file order and with the file's types, exactly like the same table loaded in memory; aselect()is pushed down into the scan. Graph ops still read only the columns they need, so index-build memory is unchanged (#160). Scanned endpoints also keep their file type in relational output (anint32column staysint32) instead of being widened toint64. - Weight expressions on a
scan_edgesframe can reference thesrc/dstcolumns; previously they failed with "No field named ..." (#154). sort()on a dictionary-encoded (categorical) column raisedArrowNotImplementedError, and so didsum/mean/min/maxover one ingroup_by().agg(). Sorting now orders by the values (not the dictionary indices), and the column keeps its dictionary type in the output (#159).scan_edgesandscan_nodesnow return rows in file order on every run. A file large enough to be read as several parallel partitions previously came back in a run-dependent order, so dense ids, component labels,edge_idsand PageRank's last bits changed between runs over the same file. Output over a scan now matchesfrom_arrowover the same table exactly (#148).scan_edgesandscan_nodesover a Parquet file with string ids failed with "Utf8View is not a supported id type", even for a plainstringcolumn, because DataFusion reads Parquet strings asUtf8View. Scans now read string columns as the file declares them, and the id map readsUtf8Viewnatively (no cast, so the 2 GiBUtf8cap is not involved).- Every string layout now works as node ids, scanned or in memory:
string,large_string,string_view(including tables that came from polars through the Arrow C stream) and dictionary-encoded (categorical) ids, which previously raisedTypeErroror "Dictionary(Int32, Utf8) is not a supported id type". filter()/sort()on ascan_nodesframe with a string attribute column failed withArrowNotImplementedError(nostring_viewkernel); string attributes now arrive asstring.neighbors().agg(n_unique=...)over a dictionary-encoded string attribute is treated as a string, not cast to a number.- A kernel that asked for the lazily built transpose or undirected view from
inside a parallel loop could deadlock, e.g.
neighbors().agg()orhopwithdirection="in"/"both"on graphs above 65,536 edges.
Changed¶
-
Behaviour change: relational steps (
filter,select,rename,sort,head,distinct,sample,group_by().agg(),join) now take effect in the order they are written, as in Polars, on every collect path. Previously each path applied them in a fixed internal order, which gave wrong results for some orderings (see Fixed) and rejected others. Orderings that used to raise now run as written:sort/head/renamebeforegroup_by, afilteraftergroup_by(SQLHAVING),selectaftergroup_by, chainedrenames, andrenamethenjoinon the new key. A few pipelines that used to succeed incorrectly now raise: afilteron a column's old name afterrename, afilteron a column that an earlierselectdropped, and a non-filter step on the edges beforenodes(). The common filter/sort/head/select tail on graph-derived frames still runs in DataFusion. -
Behaviour change:
from_networkxnow writes each edge of an undirectednx.Graph/nx.MultiGraphin both directions (a self-loop stays one row), so the defaultdirection="out"gives NetworkX's undirected values forpagerank,closeness,density,diameterand the rest. Previously each edge was written once, which silently produced directed results. Passsymmetrize=Falsefor the old one-row-per-edge frame.nx.DiGraphinput is unchanged. On a symmetrized framebetweennesscounts each unordered pair twice with the default; passdirection="both"to match NetworkX (#124). .to_polars()no longer appears in first-contact examples (the module andursa.datasetsdocstrings, the Quickstart,examples/quickstart.py), which now printcollect()or use.to_arrow()/.to_dicts(), so they run on a bare install. Polars remains an optional extra; its one example lives in the Output guide.-
The package summary (
pip show ursa-graph) and the README install line now name the import name,ursa. -
Building the graph index over an unweighted
scan_edgessource no longer holds the scanned Arrow endpoints for the whole build. Each batch is interned and freed as it is decoded, inside one native call, so the 16 B/edge input never accumulates. On a 30M-edge Parquet file the build's peak memory fell from about 45 to 24 B/edge, and the footprint after the build from about 33 to 17 B/edge, with build time unchanged (#149). Weighted scans keep the previous path, since their weight columns must outlive the build. - Faster and leaner throughout; every kernel's output is unchanged unless noted. Timings on a 4-core machine:
- Index build: known ids are interned in parallel, and scans read 128K-row batches. A 30M-edge Parquet scan and build went from ~2.9s to ~1.65s; with 2M string ids, from ~8.5s to ~3.1s.
- In-memory frames (
from_arrow,from_polars,EdgeFrame(...), ...) no longer keep a concatenated copy of thesrc/dstcolumns next to the table; they share its chunks. On 30M int edges the build went from 2.7s to 1.6s (27 to 22 B/edge over the table); on 20M string edges, from 6.9s and 71 B/edge to 1.9s and 24 B/edge. - String node ids are stored once, in the id column's own buffers, instead of about 140 B of per-id overhead. On 20M edges and 2M ids the build peak fell from 36 to 27 B/edge.
- The transpose that in-direction kernels use is built straight from the out-CSR, without per-row endpoint arrays, so it is no longer the peak: 35 to 30 B/edge on a 30M-edge graph.
triangle_countuses the degree-ordered forward algorithm (6–7× faster on skewed graphs), andclustering_coefficientbenefits too.label_propagation(6×) andlouvain(3–4×) count votes and community weights in dense arrays instead of hash maps. Louvain's aggregation now sums in a fixed order rather than a randomly seeded hash map's.pagerankdivides by out-degree once per node, not per edge (1.8×).- Weight expressions are compiled once and evaluated per batch, and columns that share an expression share one evaluation.
- Smaller items: masks built from packed bits, a bounded CSR-build histogram on many-core machines, and a leaner strongly-connected-components kernel.
- An edge mask whose length does not match the graph's edge count is rejected instead of silently dropping the edges past its end.
Security¶
- Bumped
rustls(pulled in by the object-store TLS stack used fors3:///gs:///az:///https://scans) from 0.23.45 to 0.23.46 for RUSTSEC-2026-0346, -0347, -0348 and -0349.
0.3.0 — 2026-10-08¶
Added¶
ursa.datasets: bundled graphs that load offline from the wheel (karatewith faction labels,lesmisweighted,florentine,kite), plusfacebook(SNAP ego-Facebook), downloaded on first use and cached under$URSA_DATA_HOME.list_datasets()returns the registry.- Interop constructors
from_edgelist,from_networkx,nodes_from_networkx,from_numpyandfrom_scipy_sparse. networkx, numpy and scipy remain optional and are imported only when the matching constructor is called. group_by(*keys).agg(...), withmean,sum,min,max,countandn_uniqueaggregations, optionally aliased or named throughagg(name=...).join(other, on=, how=): an equi-join of two frames on shared key columns,innerorleft. Distinct from the automatic attribute attach.rename(mapping)andsample(n, seed=)on the shared relational tail.- Filter predicates now lower as a full algebra: string and numeric
comparisons, boolean
&/|/~, arithmetic, and column-to-column comparisons. Previously only a singlecol <op> numbercomparison executed. - Graph operations over a filtered edge frame (subgraph views), and over a
traversal result from
hoporshortest_path. dtype="f32"on the float-valued kernels (pagerank,closeness,betweenness,clustering_coefficient) and onneighbors().agg(), which emits the result column as 32-bit float. The kernel still accumulates in f64 and the emitted value is that result cast down, so it agrees within f32 precision. The integer-valued kernels take nodtype. The default output is unchanged.http(s)://reads for a single hosted Parquet or CSV file.on_null="drop"on edge inputs (EdgeFrame,from_arrow,from_edgelist,scan_edges,read_edges), which filters rows with a nullsrcordstand reports the dropped count as a warning. The default remains"error".- Documentation site at https://cldixon.github.io/ursa/: a quickstart, one guide per task, a reference, a limits page, and a semantics reference that pins each kernel to the NetworkX call it is checked against. Every example on the site runs in the test suite.
Changed¶
- A query naming several graph algorithms now shares work across its columns
instead of recomputing per column. Two columns naming the same kernel with the
same parameters run it once — including the same kernel at two output dtypes,
since
dtype=narrows on emit and so is not part of a computation's identity. Separately,triangle_countandclustering_coefficientin onewith_columnsnow share the sorted-adjacency intersection pass they both rest on, where previously each ran its own; over a subgraph view they also share the masked undirected adjacency, which is rebuilt per use rather than cached. Values are unchanged and bit-identical either way. rayonis now an on-by-default feature of theursa-corecrate. With it disabled the crate compiles forwasm32-unknown-unknown, single-threaded, andrand's default features — and sogetrandom— are dropped, since the stochastic kernels use only seeded ChaCha streams. Serial and parallel outputs are bit-identical. This affects Rust consumers ofursa-coreonly: the Python wheels build with default features and are unchanged.repr()of a collected frame renders the head as a table with the shape, column names and dtypes, capped at 10 rows. It previously showed only a shape and a column list, which left results opaque in a REPL. The preview reads only the rows it displays, so its cost does not scale with row count.to_polars()raises aModuleNotFoundErrornaming theursa-graph[polars]extra when polars is absent, in place of a bare import error.- The README documents installation, and the PyPI project metadata links the documentation site.
version,ModuleTypeandPackageNotFoundErrorare no longer exposed in theursanamespace.__version__and__core_version__are unchanged.
Fixed¶
edges.filter(...).collect()andedges.distinct().collect()return rows; both previously raisedNotImplementedError.
0.2.0 — 2026-08-01¶
Performance improvements and syntax standardization.
0.1.1 — 2026-07-23¶
Fixed a missing Arrow dependency.
0.1.0 — 2026-07-21¶
Initial release.