Skip to main content

create_streaming_context

Function create_streaming_context 

Source
pub fn create_streaming_context() -> SessionContext
Expand description

Creates a DataFusion session context configured for streaming queries.

The context is configured with:

  • Batch size of 8192 (balanced for streaming throughput)
  • Single partition (streaming sources are typically not partitioned)
  • Identifier normalization disabled (mixed-case columns work unquoted)
  • All streaming UDFs registered (TUMBLE, HOP, SESSION, WATERMARK)
  • StreamingPhysicalValidator in Reject mode (blocks unsafe plans)

The watermark UDF is initialized with no watermark set (returns NULL). Use register_streaming_functions_with_watermark to provide a live watermark source.

§Example

let ctx = create_streaming_context();
ctx.register_table("events", provider)?;
let df = ctx.sql("SELECT * FROM events").await?;