Expand description
The graph functions in SQL: which of ursa_core::catalog’s functions a
query can call, how a call’s SQL arguments become a catalog Call, and
the wording of every message about them.
The catalog is the single source of truth for names, parameters, defaults, accepted values and output types, shared with the Python library, so a call means the same thing in both. This module only adds SQL’s choices:
- Which functions. Every algorithm, every statistic and the neighbour
aggregation. The layouts (
layout_fr,layout_random,layout_circle) are left out ([in_sql]), hidden until the visualization work, as they are from the Python library’s public API. A call fails as an unknown function would, and no message or listing names them. - Node values. The neighbour aggregation (
neighbors_agg) reads one value per node. SQL gives them as a query of(id, value)rows,values => (SELECT id, age FROM people)(VALUES, a parameter only SQL has), or as an expression over the graph’s node table,attribute => age(the catalog’sattribute). Either is planned as a child of the graph node, as a traversal’s node ids are. - No
dtype. SQL hasCAST; a call never narrows its own column. weight =>is an expression over the edge table’s columns, planned by the relation planner as a column of the node’s edge plan, not a literal resolved here.- Messages, worded for SQL:
pagerank(damping =>) must be a number; got 'high'.
Enums§
- Literal
- A literal argument as written: a (possibly signed) number, a string, a
boolean or
NULL.
Constants§
- ALGORITHMS
- The multi-algorithm table function:
algorithms(g, degree(), c => louvain()). - N_
DROPPED_ EDGES describe’s count of the edges left out of the graph because an endpoint is not a key of its vertex table (#311). SQL’s own column: a Python graph has no vertex table, so it would always be 0 there.- URSA_
FUNCTIONS - The function catalog as a table:
SELECT * FROM ursa_functions(). - VALUES
neighbors_agg(values => (SELECT id, value FROM ...)): the node values as a query. SQL’s alternative to the catalog’sattribute, which in SQL is an expression over the graph’s node table.- VALUES_
QUERY - The form of a
values =>argument, for messages.
Functions§
- did_
you_ mean - The closest of
candidatestoname, if one is close enough to be a typo (the graph DDL’s rule, so every “did you mean” agrees). - display_
call - The call as SQL would spell it, every literal parameter shown, and the
weight when there is one: for
EXPLAIN. - is_
per_ node - Whether
specreturns one row per node (an algorithm), as opposed to one row for the whole graph (a statistic). - lookup
- The catalog function called
name, if SQL can call it. - names
- The names of the graph table functions: the catalog’s, the traversals,
then
algorithms. - nested_
signature pagerank(damping => 0.85, ...): a call as written insidealgorithms().- outputs
- The columns a call to
specreturns in SQL, besidesid: the catalog’s, then fordescribeN_DROPPED_EDGES. An output’sfieldindexes this list; past the catalog’s own, the engine computes it (kernels). - resolve
- Resolve the literal arguments of a call to
spec(names already normalized;weightalready taken out by the caller) to aCall. - signature
pagerank(<graph>, damping => 0.85, ...): the call with every parameter at its default, for messages.- specs
- Every catalog function SQL can call, in catalog order.
- sql_doc
- A parameter’s one-line description, as SQL reads it.
- sql_
params - The parameters a SQL call can name: all but
dtype, in the catalog’s order, afterVALUESfor a function that reads node values. - sql_
type - How SQL writes a value of parameter
name, of typety:number,string,query… - sql_
value - A catalog value as SQL writes it:
NULL,'out',30,0.85,1e-6. - unknown_
param - “pagerank() has no parameter ‘dampng’; did you mean ‘damping’? …”.