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

Implement From<Arc<LogicalPlan>> for LogicalPlanBuilder #10466

Merged
merged 3 commits into from
May 13, 2024

Conversation

AbrarNitk
Copy link
Contributor

@AbrarNitk AbrarNitk commented May 12, 2024

Which issue does this PR close?

Closes #10465

Rationale for this change

What changes are included in this PR?

This PR implements From trait for converting Arc<LogicalPlan> into LogicalPlanBuilder

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions github-actions bot added the logical-expr Logical plan and expressions label May 12, 2024
@AbrarNitk AbrarNitk changed the title implement From<Arc<LogicalPlan>> for LogicalPlanBuilder implement From<Arc<LogicalPlan>> for LogicalPlanBuilder May 12, 2024
@AbrarNitk AbrarNitk changed the title implement From<Arc<LogicalPlan>> for LogicalPlanBuilder Implement From<Arc<LogicalPlan>> for LogicalPlanBuilder May 12, 2024
@alamb
Copy link
Contributor

alamb commented May 13, 2024

Thanks @AbrarNitk ! I started the CI checks on this PR

Normally I think we should add some test coverage so we don't accidentally break this in the future.

This would I think this could take the form of:

  1. (Ideally) find an example of wat
  2. Add a doc example
  3. Add a unit test

However, in this case perhaps I think we could simply merge this PR and then use the code in #10460 with @ClSlaid

Looks like the CI failed for running rust fmt https://github.com/apache/datafusion/actions/runs/9050685356/job/24892712284?pr=10466

Can you fix that and then we can get this PR merged?

Thanks agian

@AbrarNitk
Copy link
Contributor Author

AbrarNitk commented May 13, 2024

Hey @alamb, I am glad you have checked PR. I am new to datafusion and arrow, will keep learning and also keep sending the PRs :). Thank you 🙏

@alamb
Copy link
Contributor

alamb commented May 13, 2024

Hey @alamb, I am glad you have checked PR. I am new to datafusion and arrow, will keep learning and also keep sending the PRs :). Thank you 🙏

Thank you and welcome to the community! I started CI again

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.

Thanks @AbrarNitk -- I think this is a nice improvement and a good first contribution ❤️

Merging it in so we can potentially use it in #10460

@@ -1138,6 +1139,31 @@ impl LogicalPlanBuilder {
)?))
}
}

/// Converts a `Arc<LogicalPlan>` into `LogicalPlanBuilder`
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI in general, the style of docs in Rust is to put them in triple quotes which will ensure they are actually run as part of the CI tests (cargo test --doc will run them)

So in this case like

/// ```
/// fn employee_schema() -> Schema {
...

Any chance you are willing to make a follow on PR to change this to a docstring @AbrarNitk ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I will raise another PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @alamb, please check the PR: #10466

@alamb alamb merged commit 3491f6b into apache:main May 13, 2024
24 checks passed
@AbrarNitk AbrarNitk deleted the log-plan-builer-from-plan branch May 14, 2024 04:47
findepi pushed a commit to findepi/datafusion that referenced this pull request Jul 16, 2024
…0466)

* implement From<Arc<LogicalPlan>> for LogicalPlanBuilder

* make fmt happy

* added test case and doc comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement LogicalPlanBuilder::from for Arc<LogicalPlan>
2 participants