Skip to main content

format_with_registry

Function format_with_registry 

Source
pub fn format_with_registry(
    plan: &Plan,
    options: &OutputOptions,
    registry: &ExtensionRegistry,
) -> (String, Vec<FormatError>)
Expand description

Format a Substrait plan with custom options and an extension registry.

This function allows you to provide a custom extension registry for handling extension relations, enhancement addenda, and optimization addenda.

ยงExample

use substrait_explain::extensions::examples;
use substrait_explain::{format_with_registry, OutputOptions, Parser};

let registry = examples::registry();
let parser = Parser::new().with_extension_registry(registry.clone());
let plan = parser.parse_plan(r#"
=== Plan
Root[id, payload]
  Read:Extension[id:i64, payload:string]
    + Ext:BlobStoreRead['path/to/file', limit=100]
"#).unwrap();

let (text, errors) = format_with_registry(&plan, &OutputOptions::default(), &registry);
assert!(errors.is_empty());
assert!(text.contains("BlobStoreRead"));