rafael-telles commented on a change in pull request #11507: URL: https://github.com/apache/arrow/pull/11507#discussion_r735810150
########## File path: cpp/src/arrow/flight/flight-sql/server.h ########## @@ -0,0 +1,404 @@ +// 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. + +// Interfaces to use for defining Flight RPC servers. API should be considered +// experimental for now + +#pragma once + +#include <arrow/flight/flight-sql/FlightSql.pb.h> +#include <arrow/flight/server.h> +#include <google/protobuf/any.pb.h> + +namespace pb = arrow::flight::protocol; + +namespace arrow { +namespace flight { +namespace sql { + +class FlightSqlServerBase : public FlightServerBase { + public: + Status GetFlightInfo(const ServerCallContext& context, const FlightDescriptor& request, + std::unique_ptr<FlightInfo>* info) override; + + Status DoGet(const ServerCallContext& context, const Ticket& request, + std::unique_ptr<FlightDataStream>* stream) override; + + Status DoPut(const ServerCallContext& context, + std::unique_ptr<FlightMessageReader> reader, + std::unique_ptr<FlightMetadataWriter> writer) override; + + const ActionType FLIGHT_SQL_CREATE_PREPARED_STATEMENT = + ActionType{.type = "CreatePreparedStatement", + .description = + "Creates a reusable prepared statement resource on the server.\n" + "Request Message: ActionCreatePreparedStatementRequest\n" + "Response Message: ActionCreatePreparedStatementResult"}; + const ActionType FLIGHT_SQL_CLOSE_PREPARED_STATEMENT = + ActionType{.type = "ClosePreparedStatement", + .description = + "Closes a reusable prepared statement resource on the server.\n" + "Request Message: ActionClosePreparedStatementRequest\n" + "Response Message: N/A"}; + + Status ListActions(const ServerCallContext& context, + std::vector<ActionType>* actions) override; + + Status DoAction(const ServerCallContext& context, const Action& action, + std::unique_ptr<ResultStream>* result) override; + + /// \brief Gets a FlightInfo for executing a SQL query. + /// \param[in] command The CommandStatementQuery object containing the SQL + /// statement. + /// \param[in] context Per-call context. + /// \param[in] descriptor The descriptor identifying the data stream. + /// \param[out] info The FlightInfo describing where to access the dataset. + /// \return Status. + virtual Status GetFlightInfoStatement(const pb::sql::CommandStatementQuery& command, Review comment: @lidavidm , I think we could wrap by using simple structs, like: ```c++ using CommandStatementQuery = struct CommandStatementQuery { std::string query; }; ``` And construct them right before delegating to the specialized methods like `GetFlightInfoStatement`. What do you think? -- 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]
