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

[V1] Logical lazy builders #1701

Open
rchowell opened this issue Jan 8, 2025 · 0 comments
Open

[V1] Logical lazy builders #1701

rchowell opened this issue Jan 8, 2025 · 0 comments
Labels
enhancement New feature or request V1 This is related to the V1 release of PartiQL.

Comments

@rchowell
Copy link
Contributor

rchowell commented Jan 8, 2025

Description

The partiql-plan package has simple factory methods for creating operators via Operators.<name>, but some builder pattern is helpful too. In earlier release candidates, I had some lazy builders that accept the factory. I removed this in the transition to Java and to keep the partiql-plan package simple while things were in flux.

https://gist.github.com/RCHowell/4d0ac8889a0d7951bf2f7218deff28c8

Here is a gist, but I recommend the calcite-style stack approach for multi-input operators. Also a shared context with the factory/catalogs would be super useful so you can write like,

val plans = PlanBuilder(ctx)
                      .scan("T")
                      .scan("S")
                      .join(on=eq(var("t.a"), var("s.a")
                      .build()

But there is a lot of hidden complexity here such as

  • what's in ctx? catalogs would be nice
  • where is "eq" coming from and how is it resolved?
  • are the variable names/paths parsed here?
  • when are variables resolved, since this still needs to lookup variables?
  • do you pass the factory in build(..) like the gist, or in a ctx?
  • how can you easily add functions without dealing with the complexity of "Function.Instance"?

Because these builders are additive, they were not included in the 1.0 release. If there's some use case, requirement, or ask then these questions can be worked through.

@rchowell rchowell added enhancement New feature or request V1 This is related to the V1 release of PartiQL. labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request V1 This is related to the V1 release of PartiQL.
Projects
None yet
Development

No branches or pull requests

1 participant