Skip to content

Commit

Permalink
Fix formatting (cont)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sophie Zhang committed Apr 16, 2024
1 parent 2a4bbff commit 95ef828
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
2 changes: 1 addition & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ target_link_libraries(brad_front_end
PRIVATE Arrow::arrow_shared
PRIVATE ArrowFlight::arrow_flight_shared
PRIVATE ArrowFlightSql::arrow_flight_sql_shared
gflags)
gflags)
24 changes: 9 additions & 15 deletions cpp/server/brad_server_simple.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <sstream>
#include <unordered_map>
#include <utility>
#include <functional>
#include <any>

#include <arrow/array/builder_binary.h>
#include "brad_sql_info.h"
Expand All @@ -18,10 +16,6 @@
#include <arrow/util/checked_cast.h>
#include <arrow/util/logging.h>

#include <pybind11/pybind11.h>

namespace py = pybind11;

namespace brad {

using arrow::internal::checked_cast;
Expand Down Expand Up @@ -55,18 +49,18 @@ arrow::Result<std::pair<std::string, std::string>> DecodeTransactionQuery(
std::vector<std::vector<std::any>> TransformQueryResult(
std::vector<py::tuple> query_result) {
std::vector<std::vector<std::any>> transformed_query_result;
for (const auto &tup : query_result) {
std::vector<std::any> transformed_tup{};
for (const auto &elt : tup) {
if (py::isinstance<py::int_>(elt)) {
transformed_tup.push_back(std::make_any<int>(py::cast<int>(elt)));
} else if (py::isinstance<py::float_>(elt)) {
transformed_tup.push_back(std::make_any<float>(py::cast<float>(elt)));
for (const auto &row : query_result) {
std::vector<std::any> transformed_row{};
for (const auto &field : row) {
if (py::isinstance<py::int_>(field)) {
transformed_row.push_back(std::make_any<int>(py::cast<int>(field)));
} else if (py::isinstance<py::float_>(field)) {
transformed_row.push_back(std::make_any<float>(py::cast<float>(field)));
} else {
transformed_tup.push_back(std::make_any<std::string>(py::cast<std::string>(elt)));
transformed_row.push_back(std::make_any<std::string>(py::cast<std::string>(field)));
}
}
transformed_query_result.push_back(transformed_tup);
transformed_query_result.push_back(transformed_row);
}
return transformed_query_result;
}
Expand Down
5 changes: 0 additions & 5 deletions cpp/server/brad_statement.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
#include <arrow/type.h>
#include <arrow/util/checked_cast.h>

#include <pybind11/pybind11.h>

namespace py = pybind11;
using namespace pybind11::literals;

namespace brad {

using arrow::internal::checked_cast;
Expand Down

0 comments on commit 95ef828

Please sign in to comment.