Skip to main content

Crate datafusion_match_recognize

Crate datafusion_match_recognize 

Source
Expand description

SQL MATCH_RECOGNIZE for Apache DataFusion.

This is the main application crate. new_match_recognize_context installs the functions, planners, and optimizer rules required by the extension and returns a new DataFusion context. MatchRecognizeConfig controls compile and runtime limits when an application needs values other than the defaults.

§Install the extension

Applications must depend on the matching official Apache DataFusion 56.0.0 release from crates.io. See Add the extension to an application for the dependency declaration.

use datafusion::execution::SessionStateBuilder;
use datafusion_match_recognize::new_match_recognize_context;

let builder = SessionStateBuilder::new().with_default_features();
let ctx = new_match_recognize_context(builder)?;

Register tables and run queries on the returned context. The installer preserves the builder’s configuration and extensions, replaces its query planner, and appends the required optimizer rules. See new_match_recognize_context for the registration order, replaced function registrations, duplicate-installation behavior, and possible errors. An already-created SessionContext is not modified in place.

§Cargo features

  • sql (default) installs the adapter that turns MATCH_RECOGNIZE SQL into a DataFusion logical plan. Without it, applications build plans directly through planning or supply them through another integration.
  • substrait exposes this package’s Substrait import and export helpers in the substrait module.

The advanced module exposes unstable component-by-component registration for hosts that cannot use the normal installer. Applications that build patterns directly in Rust use planning rather than those hooks.

§Guides and reference

These web links follow the current main branch. When using a pinned revision, read the corresponding files and Rustdoc from that checkout.

Re-exports§

pub use config::MatchRecognizeConfig;

Modules§

advanced
Unstable hooks for hosts that perform DataFusion registration manually.
config
Session settings used by physical planning and execution. Configuration options for MATCH_RECOGNIZE pattern matching.
planning
SQL-independent semantic planning for MATCH_RECOGNIZE.
substrait
Imports and exports MATCH_RECOGNIZE through this package’s Substrait extension.

Functions§

new_match_recognize_context
Build a DataFusion context with MATCH_RECOGNIZE support for the enabled Cargo features.