# slepik/odyplan architecture

> Architecture diagram of the GitHub repository slepik/odyplan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/slepik/odyplan
- Repository: https://github.com/slepik/odyplan

## Overview

OdyPlan is an archived C++/LLVM data-stream-management research engine; v3 is the README-designated maintained generation, while v1/v2 remain historical implementations. The intended workflow is to define a stream plan, translate it to physical operators and segments, then execute generated plan code over sources, transformations, and sinks. The README documents AOT/JIT compilation, JSON/NDJSON I/O, expressions, windows, joins, selection/projection, union, measuring, and print/write sinks. Edges for v3 use dashed, unverified links where implementation details are unsampled; v2 excerpts illustrate execution mechanics but are not treated as v3 evidence.

Main entry points: [`odyplan/v3/basic/operators/src/basic/operators/pipe/measure/physical/measure_operator.cpp`](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/pipe/measure/physical/measure_operator.cpp) (Measure), [`odyplan/v3/basic/operators/src/basic/operators/source/read/runtime/read_runtime.cpp`](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/source/read/runtime/read_runtime.cpp) (Read source), [`odyplan/v3/basic/io/include/basic/io/json/json_sink.h`](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/io/include/basic/io/json/json_sink.h) (JSON and NDJSON), [`odyplan/v3/basic/operators/src/basic/operators/pipe/select/physical/select_operator.cpp`](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/pipe/select/physical/select_operator.cpp) (Select)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plan["Plan modeling"]
  node_builder["Plan builder<br/>[plan_builder.cpp]"]
  node_logical["Logical plan<br/>[plan.cpp]"]
end

subgraph group_engine["Physical execution"]
  node_physical["Physical plan<br/>[plan.cpp]"]
  node_construction["Plan construction"]
  node_segments["Segment builder"]
  node_runtime["Segment runtime"]
  node_types["Runtime types"]
end

subgraph group_operators["Stream operators"]
  node_read["Read source<br/>[read_runtime.cpp]"]
  node_select["Select"]
  node_project["Project"]
  node_join["Join<br/>[join_operator.cpp]"]
  node_joinruntime["Join runtime<br/>[join_runtime.h]"]
  node_window["Window operators"]
  node_union["Union<br/>[union_operator.cpp]"]
  node_measure["Measure"]
  node_print["Print sink<br/>[print_runtime.cpp]"]
  node_write["Write sink<br/>[write_runtime.cpp]"]
end

subgraph group_io["I/O and expressions"]
  node_expressions["Expressions"]
  node_registry["I/O registry<br/>[io_registry.h]"]
  node_formats["JSON and NDJSON<br/>[json_sink.h]"]
end

node_input(("Stream input"))
node_output(("Stream output"))

node_builder -.->|"builds"| node_logical
node_builder -.->|"translates"| node_physical
node_physical -.->|"constructs"| node_construction
node_construction -.->|"assembles"| node_segments
node_segments -.->|"executes"| node_runtime
node_types -.->|"provides types"| node_runtime
node_input -.->|"supplies records"| node_read
node_read -.->|"streams tuples"| node_select
node_select -.->|"streams tuples"| node_project
node_expressions -.->|"evaluates predicates"| node_select
node_expressions -.->|"computes fields"| node_project
node_join -->|"uses runtime"| node_joinruntime
node_window -.->|"streams windows"| node_measure
node_union -.->|"streams tuples"| node_measure
node_measure -.->|"sends results"| node_print
node_measure -.->|"sends results"| node_write
node_registry -.->|"registers formats"| node_formats
node_read -.->|"selects input format"| node_registry
node_write -.->|"selects output format"| node_registry
node_formats -.->|"decodes"| node_input
node_formats -.->|"encodes"| node_output

click node_builder "https://github.com/slepik/odyplan/blob/main/odyplan/v3/core/builder/src/core/builder/plan_builder.cpp"
click node_logical "https://github.com/slepik/odyplan/blob/main/odyplan/v3/core/logical/src/core/logical/plan/plan.cpp"
click node_physical "https://github.com/slepik/odyplan/blob/main/odyplan/v3/core/physical/src/core/physical/plan/plan.cpp"
click node_construction "https://github.com/slepik/odyplan/blob/main/odyplan/v3/core/physical/src/core/physical/plan/detail/plan_construction.cpp"
click node_segments "https://github.com/slepik/odyplan/blob/main/odyplan/v3/core/physical/src/core/physical/segment/segment_builder.cpp"
click node_runtime "https://github.com/slepik/odyplan/blob/main/odyplan/v3/core/runtime/src/core/runtime/compute_segment_runtime.cpp"
click node_types "https://github.com/slepik/odyplan/blob/main/odyplan/v3/core/runtime/src/core/runtime/types/runtime_type_registry.cpp"
click node_read "https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/source/read/runtime/read_runtime.cpp"
click node_select "https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/pipe/select/physical/select_operator.cpp"
click node_project "https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/pipe/project/physical/project_operator.cpp"
click node_join "https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/pipe/join/physical/join_operator.cpp"
click node_joinruntime "https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/include/basic/operators/pipe/join/runtime/join_runtime.h"
click node_window "https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/pipe/window/physical/count_window_operator.cpp"
click node_union "https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/pipe/union/physical/union_operator.cpp"
click node_measure "https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/pipe/measure/physical/measure_operator.cpp"
click node_print "https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/sink/print/runtime/print_runtime.cpp"
click node_write "https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/sink/write/runtime/write_runtime.cpp"
click node_expressions "https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/expression/src/basic/expression/physical/expression_codegen.cpp"
click node_registry "https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/io/include/basic/io/io_registry.h"
click node_formats "https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/io/include/basic/io/json/json_sink.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_builder,node_logical toneBlue
class node_physical,node_construction,node_segments,node_runtime,node_types toneAmber
class node_read,node_select,node_project,node_join,node_joinruntime,node_window,node_union,node_measure,node_print,node_write toneMint
class node_expressions,node_registry,node_formats toneRose
class node_input,node_output toneIndigo
```

## Components

### Plan modeling

- [Plan builder](https://github.com/slepik/odyplan/blob/main/odyplan/v3/core/builder/src/core/builder/plan_builder.cpp): `odyplan/v3/core/builder/src/core/builder/plan_builder.cpp`
- [Logical plan](https://github.com/slepik/odyplan/blob/main/odyplan/v3/core/logical/src/core/logical/plan/plan.cpp): `odyplan/v3/core/logical/src/core/logical/plan/plan.cpp`

### Physical execution

- [Physical plan](https://github.com/slepik/odyplan/blob/main/odyplan/v3/core/physical/src/core/physical/plan/plan.cpp): `odyplan/v3/core/physical/src/core/physical/plan/plan.cpp`
- [Plan construction](https://github.com/slepik/odyplan/blob/main/odyplan/v3/core/physical/src/core/physical/plan/detail/plan_construction.cpp): `odyplan/v3/core/physical/src/core/physical/plan/detail/plan_construction.cpp`
- [Segment builder](https://github.com/slepik/odyplan/blob/main/odyplan/v3/core/physical/src/core/physical/segment/segment_builder.cpp): `odyplan/v3/core/physical/src/core/physical/segment/segment_builder.cpp`
- [Segment runtime](https://github.com/slepik/odyplan/blob/main/odyplan/v3/core/runtime/src/core/runtime/compute_segment_runtime.cpp): `odyplan/v3/core/runtime/src/core/runtime/compute_segment_runtime.cpp`
- [Runtime types](https://github.com/slepik/odyplan/blob/main/odyplan/v3/core/runtime/src/core/runtime/types/runtime_type_registry.cpp): `odyplan/v3/core/runtime/src/core/runtime/types/runtime_type_registry.cpp`

### Stream operators

- [Read source](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/source/read/runtime/read_runtime.cpp): `odyplan/v3/basic/operators/src/basic/operators/source/read/runtime/read_runtime.cpp`
- [Select](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/pipe/select/physical/select_operator.cpp): `odyplan/v3/basic/operators/src/basic/operators/pipe/select/physical/select_operator.cpp`
- [Project](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/pipe/project/physical/project_operator.cpp): `odyplan/v3/basic/operators/src/basic/operators/pipe/project/physical/project_operator.cpp`
- [Join](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/pipe/join/physical/join_operator.cpp): `odyplan/v3/basic/operators/src/basic/operators/pipe/join/physical/join_operator.cpp`
- [Join runtime](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/include/basic/operators/pipe/join/runtime/join_runtime.h): `odyplan/v3/basic/operators/include/basic/operators/pipe/join/runtime/join_runtime.h`
- [Window operators](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/pipe/window/physical/count_window_operator.cpp): `odyplan/v3/basic/operators/src/basic/operators/pipe/window/physical/count_window_operator.cpp`
- [Union](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/pipe/union/physical/union_operator.cpp): `odyplan/v3/basic/operators/src/basic/operators/pipe/union/physical/union_operator.cpp`
- [Measure](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/pipe/measure/physical/measure_operator.cpp): `odyplan/v3/basic/operators/src/basic/operators/pipe/measure/physical/measure_operator.cpp`
- [Print sink](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/sink/print/runtime/print_runtime.cpp): `odyplan/v3/basic/operators/src/basic/operators/sink/print/runtime/print_runtime.cpp`
- [Write sink](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/operators/src/basic/operators/sink/write/runtime/write_runtime.cpp): `odyplan/v3/basic/operators/src/basic/operators/sink/write/runtime/write_runtime.cpp`

### I/O and expressions

- [Expressions](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/expression/src/basic/expression/physical/expression_codegen.cpp): `odyplan/v3/basic/expression/src/basic/expression/physical/expression_codegen.cpp`
- [I/O registry](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/io/include/basic/io/io_registry.h): `odyplan/v3/basic/io/include/basic/io/io_registry.h`
- [JSON and NDJSON](https://github.com/slepik/odyplan/blob/main/odyplan/v3/basic/io/include/basic/io/json/json_sink.h): `odyplan/v3/basic/io/include/basic/io/json/json_sink.h`

### Other components

- **Stream input**
- **Stream output**

## Connections

- Plan builder → Logical plan: builds
- Plan builder → Physical plan: translates
- Physical plan → Plan construction: constructs
- Plan construction → Segment builder: assembles
- Segment builder → Segment runtime: executes
- Runtime types → Segment runtime: provides types
- Stream input → Read source: supplies records
- Read source → Select: streams tuples
- Select → Project: streams tuples
- Expressions → Select: evaluates predicates
- Expressions → Project: computes fields
- Join → Join runtime: uses runtime (evidence: `odyplan/v3/basic/operators/src/basic/operators/pipe/join/physical/join_operator.cpp`)
- Window operators → Measure: streams windows
- Union → Measure: streams tuples
- Measure → Print sink: sends results
- Measure → Write sink: sends results
- I/O registry → JSON and NDJSON: registers formats
- Read source → I/O registry: selects input format
- Write sink → I/O registry: selects output format
- JSON and NDJSON → Stream input: decodes
- JSON and NDJSON → Stream output: encodes
