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

Split create_logical_plan() into parsing and planning #4957

Closed
avantgardnerio opened this issue Jan 17, 2023 · 0 comments · Fixed by #4958
Closed

Split create_logical_plan() into parsing and planning #4957

avantgardnerio opened this issue Jan 17, 2023 · 0 comments · Fixed by #4958
Labels
bug Something isn't working

Comments

@avantgardnerio
Copy link
Contributor

Describe the bug

It's not really a bug, more of an API regression. When #4607 got merged, consumers of the DataFusion public API lost the ability to (easily) inspect or alter the AST of a SQL statement before it got planned. This is because the function that runs it became non-trivial in that it copies tables into a new context, so now the consumer would either have to duplicate the table copying logic, or go without.

To Reproduce

This used to work:

        let statements = DFParser::parse_sql(sql)?;
        let statements: Vec<_> = statements.into_iter().collect();

       // Do something with AST here

        let state = df_ctx.state();
        let planner = SqlToRel::new(&state);
        let plan = planner.statement_to_plan(stmt).map_err(|e| err!("", e))?;
        let df = Arc::new(DataFrame::new(df_ctx.state(), plan));

But now it yields: ContextProvider not implented for SessionState

Expected behavior

A way to parse, manipulate AST, then plan separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant