You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "avantgardnerio (via GitHub)" <gi...@apache.org> on 2023/05/29 16:23:25 UTC

[GitHub] [arrow-rs] avantgardnerio commented on a diff in pull request #4296: feat(flight): add helpers to handle `CommandGetCatalogs`, `CommandGetSchemas`, and `CommandGetTables` requests

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: github-unsubscribe@arrow.apache.org

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