Skip to content

Expose SessionContext.add_analyzer_rule for Python-defined analyzer rules #1575

@timsaucer

Description

@timsaucer

Background

SessionContext::add_analyzer_rule registers an Arc<dyn AnalyzerRule> that runs during plan analysis (the pre-optimization pass that resolves names, applies type coercion, etc.). The Python bindings do not expose this method.

Upstream signature

pub fn add_analyzer_rule(&self, analyzer_rule: Arc<dyn AnalyzerRule + Send + Sync>)

User value

Lets users intercept and transform a logical plan immediately after analysis, before the main optimizer runs. Useful for custom semantic validation, injecting domain-specific defaults, or rewriting unresolved references against an external catalog.

Why deferred

Blocked upstream, same root cause as #1574 (add_optimizer_rule): no FFI bridge exists for the logical AnalyzerRule trait, and a Python-only adapter can observe but not meaningfully transform LogicalPlan nodes because there are no Python constructors for the variants. Tracked here; revisit when upstream lands an FFI_AnalyzerRule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions