Skip to content

Conversation

@waynexia
Copy link
Member

Which issue does this PR close?

Closes #.

Rationale for this change

This patch makes sql_statement_to_plan_with_context() public. Compared to sql_statement_to_plan, it accepts an external PlannerContext, which allows pre-registering some external context for planning

What changes are included in this PR?

Like above

Are these changes tested?

n/a

Are there any user-facing changes?

A new public API sql_statement_to_plan_with_context

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
@github-actions github-actions bot added the sql SQL Planner label Aug 11, 2023
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @waynexia

This looks fine to me -- if you plan to use this as an external project, I recommend you add some sort of end to end test (perhaps somewhere in https://github.com/apache/arrow-datafusion/tree/main/datafusion-examples/examples) -- otherwise I could see this being easily broken in a refactor


/// Generate a logical plan from an SQL statement
fn sql_statement_to_plan_with_context(
pub fn sql_statement_to_plan_with_context(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rename sql_statement_to_plan_with_context_impl to sql_statement_to_plan_with_context and make it pub and get the same effect with less code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the author didn't want to change the api? and only want to make it public?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I think this PR could be merged in as is. @waynexia feel free to merge it (or let us know you plan to make more changes)

Copy link
Contributor

@liukun4515 liukun4515 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alamb
Copy link
Contributor

alamb commented Aug 21, 2023

Merging to reduce the number of outstanding pull requests. Thanks everyone for your comments

@alamb alamb merged commit 9d26397 into apache:main Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sql SQL Planner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants