Skip to content

Execution Plans

SQL parsing, lazy execution, and Arrow-native UDF execution for Tabular data — yggdrasil.plan.

For the full walkthrough (SQL features, joins, CTEs, UDF registration), see the Execution Plans & SQL guide. Full signatures live in the auto-generated API reference.

from yggdrasil.plan import parse_sql
from yggdrasil.arrow.tabular import ArrowTabular
import pyarrow as pa

users = ArrowTabular(pa.table({
    "id": [1, 2, 3],
    "name": ["alice", "bob", "carol"],
    "score": [90, 80, 95],
}))

node = parse_sql("SELECT name, score FROM users WHERE score > 80 ORDER BY score DESC")
result = node.execute(tables={"users": users})
print(result.read_arrow_table().to_pylist())
# [{'name': 'carol', 'score': 95}, {'name': 'alice', 'score': 90}]

Surface

Symbol Role
parse_sql Parse a SQL string into an executable plan node
SQLQueryParser The underlying parser
ExecutionPlan / SelectPlan Plan objects
LazyTabular Deferred, lazily-evaluated Tabular
PlanNode Base node — SelectNode, InsertNode, MergeNode, ScanNode
FunctionRegistry / FunctionMeta UDF registry + metadata
BUILTIN_REGISTRY Built-in functions (incl. explode_table, posexplode_table)
yggdrasil.plan.ops Relational ops — joins, group-by, order-by, union, CTEs