nl2sql

DecomposerNode

Overview


Responsibilities


Position in Execution Graph

Upstream:

Downstream:

Trigger conditions:

flowchart LR
    Resolver[DatasourceResolverNode] --> Decomposer[DecomposerNode] --> Planner[GlobalPlannerNode]

Inputs

From GraphState:

Validation performed:


Outputs

Mutations to GraphState:

Side effects:


Internal Flow (Step-by-Step)

  1. Validate resolver response; raise if no resolved datasources.
  2. Build resolved_payload and schema_version_map.
  3. Invoke LLM chain with user_query and resolved datasources.
  4. For each LLM sub‑query:
    • Validate datasource existence and RBAC allowance.
    • Assign deterministic ID via _stable_id().
    • Attach schema version.
  5. Remap combine groups to stable sub‑query IDs.
  6. Assign deterministic IDs to post‑combine ops.
  7. Sort sub‑queries, combine groups, and post‑combine ops.
  8. Return DecomposerResponse.
  9. On exception, emit ORCHESTRATOR_CRASH error.

Contracts & Interfaces

Implements a LangGraph node callable:

def __call__(self, state: GraphState) -> Dict[str, Any]

Key contracts:


Determinism Guarantees


Error Handling

Emits PipelineError with:

Logs failures via logger.error.


Retry + Idempotency


Performance Characteristics


Observability


Configuration


Extension Points


Known Limitations