Skip to content

API to add analyzer_rules #10846

@alamb

Description

@alamb

Is your feature request related to a problem or challenge?

@goldmedal reports on discord: https://discord.com/channels/885562378132000778/1166447479609376850/1249052209388326922

Hi, I tried to implement some AnalyzerRule to rewrite and analyze the logical plan. I have implemented the AnalyzerRules that work fine with Analyzer::with_rules. However, when I tried to register them to the SessionContext, I couldn't find any method for it. I can only do something like:

let ctx = SessionContext::new();
let new_st = ctx.state().add_analyzer_rule(Arc::new(ModelAnalyzeRule::new(Arc::clone(&analyzed_mdl))));
let new_st = new_st.add_analyzer_rule(Arc::new(ModelGenerationRule::new(Arc::clone(&analyzed_mdl))));
let new_ctx = SessionContext::new_with_state(new_st);

The new session context works fine with the rules I added, but I can't find a way to register the rules to the session context directly.

Does this approach make sense? Or is there a better way to do this?

Is there any method like SessionContext::register_analyzer_rule that can add the rules to the analyzer rules list?

Describe the solution you'd like

I would like a function on SessionContext that can update the analyzer rules directly

Describe alternatives you've considered

I suggest adding SessionContext::add_analyzer_rule that simply calls SessionState::add_analyzer_rule

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions