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

feat(python): PyVelox bindings for PlanBuilder and PlanNode #12101

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pedroerp
Copy link
Contributor

Summary:
Adding Python bindings to allow plans to be built using PlanBuilder.
Plan builder is still a test dependency, but will be moved out of test soon.

Differential Revision: D68002774

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 16, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D68002774

Copy link

netlify bot commented Jan 16, 2025

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 043a2fa
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/6789bcdf02f33400080b04b2

@pedroerp pedroerp requested review from kgpai and mbasmanova January 16, 2025 22:01
…incubator#12101)

Summary:

Adding Python bindings to allow plans to be built using PlanBuilder.
Plan builder is still a test dependency, but will be moved out of test soon.

Differential Revision: D68002774
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D68002774

Copy link
Contributor

@kgpai kgpai left a comment

Choose a reason for hiding this comment

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

Looks good, some minor nits.


if (!aliases.empty()) {
for (const auto& item : aliases) {
aliasMap[item.first.cast<std::string>()] =
Copy link
Contributor

Choose a reason for hiding this comment

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

dicts can hold anything, and in python many things can be cast to string, Would it make sense to add some validation on the contents of aliases ?
For e.g what if you pass in a key or value as a double ?


// If there are subfields, create the appropriate structures and add to the
// scan.
if (!subfields.empty() || !rowIndexColumnName.empty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment about adding some documentation and validation for subfields.

/// column name to the list of subitems to project from it.
/// @param rowIndexColumnName If defined, create an output column with that
/// name producing $row_ids. This name needs to be part of the outputSchema.
/// @param connectorId ID of the connector to use for this scan.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit : would be nice to have an example invocation.


py::class_<velox::py::PyPlanBuilder>(m, "PlanBuilder", py::module_local())
.def(py::init<>())
.def("get_plan_node", &velox::py::PyPlanBuilder::getPlanNode, py::doc(R"(
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldnt we return the plan_node only after its built ? can you call get_plan_node while you are building the plan node ?

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we should rename this to build()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants