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

Query DSL or API #98

Open
tertsdiepraam opened this issue Jan 15, 2025 · 0 comments
Open

Query DSL or API #98

tertsdiepraam opened this issue Jan 15, 2025 · 0 comments

Comments

@tertsdiepraam
Copy link
Contributor

tertsdiepraam commented Jan 15, 2025

We want Roto code to be able to query the RIBs. The design space is very big however. I see 3 main directions.

Direction 1: DSL

We add a query {} construct to the language that allows us to write queries with a custom syntax.

Imagine something like (syntax infinitely bikesheddable, I don't know what this would mean exactly either):

let q1 = query {
    some_table
    | filter(owner == "NLnet Labs")
    | any
};
let q2 = query {
    some_rib
    | filter(column_name < 5)
    | join(q1)
};
let result = q2.run();

Maybe this makes more sense as a top-level construct:

query my_query(owner: String) -> Prefix {
    ...
}

Direction 2: Builder

A more builder-like pattern, much like Datafusion LogicalPlanBuilder or Polars' expressions.

Or a bit like iterators in Rust, but with opaque types.

Direction 3: Graphical

@partim suggested this. In this design, the queries would be declared along with the setup of the entire Rotonda configuration. They would be virtual RIBs that are connected to actual RIBs. Combining virtual RIBs would then create more complex queries. This would take the feature mostly out of Roto into Rotonda. Rotonda would then probably only expose some function to run the query. The entire configuration would be a graphical representation.

Other considerations

This is blocked at least by #102. If we want to interact with queries in a procedural manner, it is also blocked by loops not being implemented.

Finally we probably want to write filtermaps and use them in queries, this requires something like first-class functions. And that probably slippery-slopes into closures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant