avantgardnerio commented on code in PR #4296:
URL: https://github.com/apache/arrow-rs/pull/4296#discussion_r1209446545


##########
arrow-flight/examples/flight_sql_server.rs:
##########
@@ -248,32 +255,106 @@ impl FlightSqlService for FlightSqlServiceImpl {
 
     async fn get_flight_info_catalogs(
         &self,
-        _query: CommandGetCatalogs,
-        _request: Request<FlightDescriptor>,
+        query: CommandGetCatalogs,
+        request: Request<FlightDescriptor>,
     ) -> Result<Response<FlightInfo>, Status> {
-        Err(Status::unimplemented(
-            "get_flight_info_catalogs not implemented",
-        ))
+        let flight_descriptor = request.into_inner();
+        let ticket = Ticket {
+            ticket: query.encode_to_vec().into(),
+        };
+
+        let options = IpcWriteOptions::default();
+
+        // encode the schema into the correct form
+        let IpcMessage(schema) = SchemaAsIpc::new(get_catalogs_schema(), 
&options)
+            .try_into()
+            .expect("valid catalogs schema");

Review Comment:
   FlightSQL is pretty good about getting errors back to the client in a 
helpful way (I routinely use DataGrip for example, and the full text of the 
error appears in a little red bar below the failed query). Since this is a 
method that already supports a Result, I think `.map_err()` would be more 
appropriate here.



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