GavinRay97 edited a comment on issue #1864:
URL: 
https://github.com/apache/arrow-datafusion/issues/1864#issuecomment-1044650838


   I came here to post an issue with the same question phrased slightly 
differently
   I was going to ask it as:
   
   > "Is there a trait/interface to implement that allows executing a 
`LogicalPlan`?"
   
   The usecase is to embed DataFusion's query engine and optimizer/planner in 
an application and then plug in an execution engine, like a database driver.
   
   In my case I'd like to experiment with building a query expression by 
translating GraphQL query operators to Expression values and then write 
"adapters"/"drivers" that can implement the optimized query expression:
   
   ```gql
   query {
     users(where: { id: { gt: 10 }, name:  { like: "%Joe" }, limit: 5) {
        id
        name
        todos(where: { is_completed: { eq: false } }) {
           description
        }
     }
   }
   ```
   
   ```rs
   let users = ctx.table("users");
   let project = ["id", "name"];
   let joins = ["todos"];
   let user_filter = and(col("id").gt(lit(10)), col("name").like("%Joe"));
   let df = df.select_columns(&project)?.filter(&user_filter)?.join(&joins);
   
   // Run query planning + optimization, convert to LogicalPlan
   // Execute LogicalPlan against SQL DB
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to