You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/07 16:50:21 UTC

[GitHub] [arrow-rs] wangfenjin commented on a change in pull request #1386: Implement basic FlightSQL Server

wangfenjin commented on a change in pull request #1386:
URL: https://github.com/apache/arrow-rs/pull/1386#discussion_r820899833



##########
File path: arrow-flight/src/sql/server.rs
##########
@@ -0,0 +1,458 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::pin::Pin;
+
+use futures::Stream;
+use protobuf::Message;
+use tonic::{Request, Response, Status, Streaming};
+
+use super::{
+    super::{
+        flight_service_server::FlightService, Action, ActionType, Criteria, Empty,
+        FlightData, FlightDescriptor, FlightInfo, HandshakeRequest, HandshakeResponse,
+        PutResult, SchemaResult, Ticket,
+    },
+    ActionClosePreparedStatementRequest, ActionCreatePreparedStatementRequest,

Review comment:
       Ha! Haven't thought about it when I'm writing the code, just follow the style in here: https://github.com/apache/arrow-rs/blob/master/arrow-flight/src/lib.rs#L51
   
   But yes, when I read the cpp implementation, they always define the struct with native fields and do the convert, even for the enum values...
   
   If we don't convert the FlightData struct, overall it should be fine and don't require too much work. But there are several drawbacks I can think of:
   1. It's kind of duplication and make the code not easy to understand. When I first read the cpp implementation, I wondering why there are duplication class definition? Are they not using any pb generator but handmade all the staff. Then I find the convert code.
   2. More code, more error prone, and more effort to maintain.
   3. The difference between cpp and rust is, we commit the generated code to repo but they don't, and the generated rust code acctually is clean and easy to understand
   4. Performance issue. In the For the struct in FlightSql, as it's small so should be fine to convert, but I'm not sure if we also want to convert FlightData, it might involve too much mem copy.




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