Skip to main content

linkrs_query/executor/
streaming.rs

1//! Streaming execution engine for pull-based iterator model
2//!
3//! This module implements a pull-based chunked streaming executor system
4//! that efficiently processes data through an operator pipeline.
5//!
6//! Key components:
7//! - DataChunk: Fixed-size batches of rows
8//! - StreamingExecutor: Enum-based pull operators
9//! - StreamingExecutionEngine: Orchestration layer
10//! - ExecutionRuntime: Per-query runtime (cancel, memory, profile, resources)
11//! - ResultStream: Streaming result handle
12
13pub mod chunk;
14pub mod context;
15pub mod engine;
16pub mod executor;
17
18pub mod helpers;
19pub mod instance;
20pub mod interner;
21pub mod join_helpers;
22pub mod memory_pool;
23pub mod operators;
24pub mod parameters;
25pub mod partition;
26pub mod plan;
27pub mod pool;
28pub mod query_registry;
29pub mod result_utils;
30pub mod runtime;
31pub mod slot;
32pub mod spill;
33pub mod state;
34pub mod stream;
35pub mod stream_result;
36pub mod subquery;
37pub mod transaction_scope;
38
39pub use chunk::{DataChunk, LocalChunkCollector, RowBufferPool};
40pub use context::BorrowedRowContext;
41pub use engine::StreamingExecutionEngine;
42pub use executor::StreamingExecutor;
43
44pub use operators::base::OperatorBase;
45pub use operators::spec::{BlockingSpec, ExchangeSpec, JoinSpec, SourceSpec, UnarySpec};
46pub use operators::state::{BlockingState, ExchangeState, JoinState, SourceState};
47pub use partition::PartitionView;
48
49pub use result_utils::{
50    chunks_to_execution_result, chunks_to_execution_result_with_spill, convert_chunks_to_dataset,
51    convert_chunks_to_dataset_with_spill,
52};
53pub use runtime::{
54    ExecutionRuntime, OperatorProfile, OperatorProfileKey, ProfileBoard, ProfileCollector,
55    ProfileEntry, QueryFinishGuard, QueryIdentity, ResourceOwner,
56};
57pub use slot::{
58    combine_layouts, combine_layouts_with_dedup, SlotId, SlotInfo, SlotLayout, SlotOrigin,
59};
60pub use stream::ResultStream;
61pub use stream_result::StreamingQueryResult;
62
63pub use plan::context::PhysicalPlanBuildContext;
64pub use plan::types::{
65    CapabilitySet, FragmentGraph, FragmentId, FragmentKind, FragmentSpec, LogicalNodeId,
66    OperatorKindSpec, OutputContract, PhysicalOperatorId, PhysicalOperatorIdAllocator,
67    PhysicalOperatorSpec, PhysicalPlan, PlanCompatibility, PlanFingerprint, SortOrder,
68};
69pub use plan::validator::{PhysicalPlanValidator, ValidationResult, ValidationTier};
70
71// ── Spill types ──
72pub use spill::{
73    finalize_partitions_with_runtime, hash_bytes_partition, hash_row_partition, schema_fingerprint,
74    DiskQuota, HashPartitionConfig, HashPartitionSpiller, RunHeader, RunReader, RunWriter,
75    SpillConfig, SpillManager, SpilledRun, COLLECTOR_RUN_ROWS_MAX, COLLECTOR_SPILL_ROWS_DEFAULT,
76    HASH_JOIN_MAX_DEPTH, HASH_JOIN_PARTITIONS_DEFAULT,
77};
78
79// ── New types ──
80pub use instance::{QueryBindings, QueryExecutionInstance, ResultSink};
81pub use query_registry::{CancelToken, QueryGuard, QueryId, QueryMetadata, QueryRegistry};
82pub use state::{
83    GlobalState, GlobalStateArena, GlobalStateKey, LocalState, LocalStateArena, LocalStateKey,
84    StateArenaSet, TaskId,
85};
86pub use transaction_scope::{
87    CancelReason, SessionTransactionController, TransactionCommandResult, TransactionId,
88    TransactionScope, TransactionState,
89};
90
91// ── Memory pool types ──
92pub use memory_pool::{
93    DatabaseMemoryPool, FragmentPool, MemoryPoolError, MemoryPoolReservation, OperatorPool,
94    PoolHandle, PooledChunk, QueryPool, TaskPool,
95};