alamb commented on a change in pull request #9645:
URL: https://github.com/apache/arrow/pull/9645#discussion_r590786673



##########
File path: rust/datafusion/examples/flight_server.rs
##########
@@ -94,28 +94,26 @@ impl FlightService for FlightServiceImpl {
                     "alltypes_plain",
                     &format!("{}/alltypes_plain.parquet", testdata),
                 )
-                .map_err(|e| to_tonic_err(&e))?;
+                .map_err(to_tonic_err)?;
 
-                // create the query plan
-                let plan = ctx
-                    .create_logical_plan(&sql)
-                    .and_then(|plan| ctx.optimize(&plan))
-                    .and_then(|plan| ctx.create_physical_plan(&plan))
-                    .map_err(|e| to_tonic_err(&e))?;
+                // create the DataFrame
+                let df = ctx.sql(sql).map_err(to_tonic_err)?;
 
                 // execute the query
-                let results =
-                    collect(plan.clone()).await.map_err(|e| to_tonic_err(&e))?;
+                let results = df.collect().await.map_err(to_tonic_err)?;
                 if results.is_empty() {
                     return Err(Status::internal("There were no results from 
ticket"));
                 }
 
+                let physical_plan = ctx

Review comment:
       @Dandandan  I gave this another look prior to merging, and something 
that looks like a pretty strange example now (where we run the query and get 
results but then build a second plan to get the schema).
   
   I wonder what you would think about using something more like `let schema = 
batches[0].schema()` instead?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to