Class LogicalPlanJson
java.lang.Object
com.darkcollective.relix.semantic.internal.LogicalPlanJson
Serializes a logical relational-algebra tree to JSON, annotating every node
with its inferred
Schema.
This is the machine-readable counterpart to IrReport's ASCII
expression trees: it walks the same RelNode structure (reusing
IrReport.baseLabel(com.darkcollective.relix.ast.RelNode, com.darkcollective.relix.symbol.table.SymbolTable) and IrReport.nodeChildren(com.darkcollective.relix.ast.RelNode)) but emits a
structured tree suitable for tooling — the playground's AST panel, and any
consumer wanting schema-bearing output.
Node shape
Each node is a JSON object:
{
"op": "Selection", // RelNode type, "Node" suffix stripped
"label": "σ amount > 100", // human-readable operator form (no [mat] tag)
"schema": { "open": false, // inferred output schema, or null if unknown
"columns": [ { "name": "amount", "type": "N" }, … ] },
"materialization": "stream", // stream | bag | set | sort
"children": [ … ] // child node objects, left-to-right
}
Leaf RelationNodes additionally carry "relation" (the
relation name) and "kind" (its symbol kind code, e.g. "SRC",
or "?" when unresolved).
Schema encoding
null— no schema was inferred for the node (its subtree failed to resolve), or the inference placeholder is present.{ "open": true, "columns": [] }— an open (schema-on-read) relation whose columns resolve dynamically at runtime.{ "open": false, "columns": [ … ] }— a closed, fully-typed schema.
IrReport:
Number, String, Boolean, ?=any.-
Method Summary
Modifier and TypeMethodDescriptionstatic StringtoJson(RelNode root, SymbolTable table, SchemaAnnotations schemas) Serializes the tree rooted atrootto a standalone JSON string.
-
Method Details
-
toJson
Serializes the tree rooted atrootto a standalone JSON string.- Parameters:
root- the root RA node; must not be nulltable- the symbol table, for leaf relation kinds; must not be nullschemas- the inferred schema annotations; must not be null- Returns:
- the JSON document for the tree
-