Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API to add analyzer_rules #10846

Closed
alamb opened this issue Jun 10, 2024 · 1 comment · Fixed by #10849
Closed

API to add analyzer_rules #10846

alamb opened this issue Jun 10, 2024 · 1 comment · Fixed by #10849
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@alamb
Copy link
Contributor

alamb commented Jun 10, 2024

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

@alamb alamb added enhancement New feature or request good first issue Good for newcomers labels Jun 10, 2024
@pingsutw
Copy link
Member

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants