github-actions[bot] commented on code in PR #25937:
URL: https://github.com/apache/doris/pull/25937#discussion_r1372597121


##########
be/src/service/arrow_flight/arrow_flight_update.cpp:
##########
@@ -0,0 +1,59 @@
+// 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.
+
+#include "service/arrow_flight/arrow_flight_update.h"
+
+#include <arrow/status.h>
+
+#include "arrow/builder.h"
+#include "runtime/exec_env.h"
+#include "runtime/result_buffer_mgr.h"
+#include "util/arrow/row_batch.h"
+#include "util/arrow/utils.h"
+
+namespace doris {
+namespace flight {
+
+
+arrow::Result<std::shared_ptr<ArrowFlightUpdate>> 
ArrowFlightUpdate::Create(const std::string& sql) {
+
+
+        std::cout << "sql is " << sql << std::endl;
+
+  std::shared_ptr<ArrowFlightUpdate> result(new ArrowFlightUpdate());
+  return result;
+}
+
+arrow::Result<int64_t> ArrowFlightUpdate::ExecuteUpdate() {
+     std::cout << "ExecuteUpdate" << std::endl;
+     return 1;
+//   return sqlite3_changes(db_);
+}
+
+arrow::Status ArrowFlightUpdate::SetParameters(

Review Comment:
   warning: method 'SetParameters' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
   static arrow::Status ArrowFlightUpdate::SetParameters(
   ```
   



##########
be/src/service/arrow_flight/flight_sql_service.cpp:
##########
@@ -17,14 +17,42 @@
 
 #include "service/arrow_flight/flight_sql_service.h"
 
+#include <algorithm>
+#include <random>
 #include <arrow/status.h>
+#include <cctz/time_zone.h>
 
 #include "arrow/flight/sql/server.h"
 #include "service/arrow_flight/arrow_flight_batch_reader.h"
+#include "service/arrow_flight/arrow_flight_update.h"
 #include "service/arrow_flight/flight_sql_info.h"
 #include "service/backend_options.h"
 #include "util/arrow/utils.h"
 #include "util/uid_util.h"
+#include "util/timezone_utils.h"
+#include "vec/columns/column.h"
+#include "vec/utils/arrow_column_to_doris_column.h"
+#include "vec/data_types/data_type_decimal.h"
+#include "vec/data_types/data_type_factory.hpp"
+#include "vec/aggregate_functions/aggregate_function.h"
+
+#include "runtime/types.h"
+#include "util/binary_cast.hpp"
+#include "vec/aggregate_functions/aggregate_function.h"

Review Comment:
   warning: duplicate include [readability-duplicate-include]
   
   be/src/service/arrow_flight/flight_sql_service.cpp:39:
   ```diff
   - #include "util/binary_cast.hpp"
   - #include "vec/aggregate_functions/aggregate_function.h"
   + #include "util/binary_cast.hpp"
   ```
   



##########
be/src/service/arrow_flight/arrow_flight_update.h:
##########
@@ -0,0 +1,66 @@
+// 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.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>

Review Comment:
   warning: 'gen_cpp/Types_types.h' file not found [clang-diagnostic-error]
   ```cpp
   #include <gen_cpp/Types_types.h>
            ^
   ```
   



##########
be/src/vec/exec/format/csv/csv_reader.cpp:
##########
@@ -240,7 +242,9 @@ CsvReader::CsvReader(RuntimeProfile* profile, const 
TFileScanRangeParams& params
     }
 }
 
-CsvReader::~CsvReader() = default;
+CsvReader::~CsvReader() {

Review Comment:
   warning: use '= default' to define a trivial destructor 
[modernize-use-equals-default]
   ```cpp
   
                        ^
   ```
   



##########
be/src/service/arrow_flight/flight_sql_service.cpp:
##########
@@ -72,6 +103,205 @@
 
         return std::make_unique<arrow::flight::RecordBatchStream>(reader);
     }
+
+    arrow::Result<int64_t> DoPutCommandStatementUpdate(
+        const arrow::flight::ServerCallContext& context,
+        const arrow::flight::sql::StatementUpdate& command) {
+    const std::string& sql = command.query;
+    ARROW_ASSIGN_OR_RAISE(auto statement, ArrowFlightUpdate::Create(sql));
+    return statement->ExecuteUpdate();
+  }
+
+    arrow::Result<int64_t> DoPutPreparedStatementUpdate(
+        const arrow::flight::ServerCallContext& context, const 
arrow::flight::sql::PreparedStatementUpdate& command,
+        arrow::flight::FlightMessageReader* reader) {
+
+        _cnt++;
+
+        ARROW_ASSIGN_OR_RAISE(auto statement, 
ArrowFlightUpdate::Create("update"));
+        
+        while (true) {
+            cctz::time_zone ctzz;
+            TimezoneUtils::find_cctz_time_zone("UTC", ctzz);
+
+            ARROW_ASSIGN_OR_RAISE(arrow::flight::FlightStreamChunk chunk, 
reader->Next());
+            if (chunk.data == nullptr) break;
+
+            const int64_t num_rows = chunk.data->num_rows();
+            if (num_rows == 0) continue;
+            // LOG(INFO) << "wuwenchi xxxx chunk.data.num_rows: " << num_rows;
+
+            // statement->SetParameters(std::move(chunk.data));
+            // 
ARROW_RETURN_NOT_OK(statement->SetParameters({std::move(chunk.data)}));
+
+            std::vector<std::shared_ptr<arrow::RecordBatch>> datas;
+            datas.push_back(std::move(chunk.data));
+            auto end = std::remove_if(
+                datas.begin(), datas.end(),
+                [](const std::shared_ptr<arrow::RecordBatch>& batch) { return 
batch->num_rows() == 0; });
+            datas.erase(end, datas.end());
+
+            clock_t t1 = clock();
+            int batch_size = datas.size();
+            for (int i=0; i<batch_size; i++)
+            {
+                arrow::RecordBatch& batch = *datas[i];
+                // 列个数
+                int num_rows = batch.num_rows();
+                int num_columns = batch.num_columns();
+                // LOG(INFO) << "wuwenchi xxxx batch.num_rows:" << num_rows;
+                // LOG(INFO) << "wuwenchi xxxx batch.num_columns:" << 
num_columns;
+                for (int c = 0; c < num_columns; ++c) {
+                    arrow::Array* column = batch.column(c).get();
+                    
+                    auto pt = 
doris::vectorized::arrow_type_to_primitive_type(column->type_id());
+                    vectorized::DataTypePtr data_type = 
vectorized::DataTypeFactory::instance().create_data_type(pt, true);
+                    vectorized::MutableColumnPtr data_column = 
data_type->create_column();
+                    vectorized::ColumnWithTypeAndName 
column_with_name(std::move(data_column), data_type, "test_numeric_column");
+
+                    Status st = 
doris::vectorized::arrow_column_to_doris_column(column, 0, 
column_with_name.column, column_with_name.type, num_rows, ctzz);
+
+                    // for (int k=0; k<num_rows; k++) {
+                    //     LOG(INFO) << "wuwenchi xxxx 
column_with_name.to_string : " << k << ": " << column_with_name.to_string(k);
+                    // }
+                }
+            }
+
+            clock_t t2 = clock();
+            _clock += (t2 - t1);
+            // LOG(INFO) << "wuwenchi xxxx time: " << t2 - t1;
+            
+
+            // {
+            //     arrow::RecordBatch& batch = *datas[0];
+            //     // 列个数
+            //     int num_rows = batch.num_rows();
+            //     int num_columns = batch.num_columns();
+            //     LOG(INFO) << "wuwenchi xxxx batch.num_rows:" << num_rows;
+            //     LOG(INFO) << "wuwenchi xxxx batch.num_columns:" << 
num_columns;
+            //     for (int c = 0; c < num_columns; ++c) {
+            //         arrow::Array* column = batch.column(c).get();
+                    
+            //         auto pt = 
doris::vectorized::arrow_type_to_primitive_type(column->type_id());
+            //         vectorized::DataTypePtr data_type = 
vectorized::DataTypeFactory::instance().create_data_type(pt, true);
+            //         vectorized::MutableColumnPtr data_column = 
data_type->create_column();
+            //         vectorized::ColumnWithTypeAndName 
column_with_name(std::move(data_column), data_type, "test_numeric_column");
+
+            //         Status st = 
doris::vectorized::arrow_column_to_doris_column(column, 0, 
column_with_name.column, column_with_name.type, num_rows, ctzz);
+
+            //         for (int i=0; i<num_rows; i++) {
+            //             LOG(INFO) << "wuwenchi xxxx 
column_with_name.to_string : " << i << ": " << column_with_name.to_string(i);
+            //         }
+            //     }
+            // }
+
+            // for (int i = 0; i < num_rows; ++i) {
+
+            //     arrow::RecordBatch& batch = *datas[0];
+
+            //     int nums = batch.num_columns();
+            //     for (int c = 0; c < nums; ++c) {
+            //         arrow::Array* column = batch.column(c).get();
+                    
+            //         auto pt = 
doris::vectorized::arrow_type_to_primitive_type(column->type_id());
+            //         vectorized::DataTypePtr data_type = 
vectorized::DataTypeFactory::instance().create_data_type(pt, true);
+            //         vectorized::MutableColumnPtr data_column = 
data_type->create_column();
+            //         vectorized::ColumnWithTypeAndName 
column_with_name(std::move(data_column), data_type, "test_numeric_column");
+            //         // 
static_cast<void>(doris::vectorized::arrow_column_to_doris_column(
+            //         // column, 
+            //         // 0, 
+            //         // column_with_name.column,
+            //         // column_with_name.type,
+            //         // 13,
+            //         // ctzz));
+            //         Status st = 
doris::vectorized::arrow_column_to_doris_column(column, 0, 
column_with_name.column, column_with_name.type, 13, ctzz);
+            //         std::cout << st << std::endl;
+                    
+            //     }
+            // }
+
+                // 
ARROW_RETURN_NOT_OK(statement->SetParameters({std::move(chunk.data)}));
+                // for (int i = 0; i < num_rows; ++i) {
+                // if (sqlite3_clear_bindings(stmt) != SQLITE_OK) {
+                //     return Status::Invalid("Failed to reset bindings on row 
", i, ": ",
+                //                         sqlite3_errmsg(statement->db()));
+                // }
+                // // batch_index is always 0 since we're calling SetParameters
+                // // with a single batch at a time
+                // ARROW_RETURN_NOT_OK(statement->Bind(/*batch_index=*/0, i));
+                // ARROW_RETURN_NOT_OK(callback());
+                // }
+        
+            break;
+        }
+        return 10;
+    }
+
+    arrow::Result<arrow::flight::sql::ActionCreatePreparedStatementResult> 
CreatePreparedStatement(
+            const arrow::flight::ServerCallContext& context,
+            const arrow::flight::sql::ActionCreatePreparedStatementRequest& 
request) {
+
+        LOG(INFO) << "CreatePreparedStatement";
+
+        std::string handle = GenerateRandomString();
+        arrow::FieldVector parameter_fields;
+        // {
+        //     parameter_fields.push_back(arrow::field("id", arrow::int32()));
+        //     parameter_fields.push_back(arrow::field("val", arrow::int32()));
+        // }
+        
+            parameter_fields.push_back(arrow::field("id", arrow::int32()));
+            parameter_fields.push_back(arrow::field("val", arrow::utf8()));
+            parameter_fields.push_back(arrow::field("val2", arrow::utf8()));
+        
+        std::shared_ptr<arrow::Schema> parameter_schema = 
arrow::schema(parameter_fields);
+
+        return arrow::flight::sql::ActionCreatePreparedStatementResult{
+            parameter_schema, parameter_schema, std::move(handle)};
+    }
+
+    std::default_random_engine gen_;
+
+    std::string GenerateRandomString() {
+        uint32_t length = 16;
+
+        // MSVC doesn't support char types here

Review Comment:
   warning: 16 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
   ngth = 16;
          ^
   ```
   



##########
be/src/service/arrow_flight/flight_sql_service.cpp:
##########
@@ -17,14 +17,42 @@
 
 #include "service/arrow_flight/flight_sql_service.h"
 
+#include <algorithm>
+#include <random>
 #include <arrow/status.h>
+#include <cctz/time_zone.h>
 
 #include "arrow/flight/sql/server.h"
 #include "service/arrow_flight/arrow_flight_batch_reader.h"
+#include "service/arrow_flight/arrow_flight_update.h"
 #include "service/arrow_flight/flight_sql_info.h"
 #include "service/backend_options.h"
 #include "util/arrow/utils.h"
 #include "util/uid_util.h"
+#include "util/timezone_utils.h"
+#include "vec/columns/column.h"
+#include "vec/utils/arrow_column_to_doris_column.h"
+#include "vec/data_types/data_type_decimal.h"
+#include "vec/data_types/data_type_factory.hpp"
+#include "vec/aggregate_functions/aggregate_function.h"
+
+#include "runtime/types.h"
+#include "util/binary_cast.hpp"
+#include "vec/aggregate_functions/aggregate_function.h"
+#include "vec/columns/column.h"
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_decimal.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/columns/column_string.h"
+#include "vec/columns/column_vector.h"
+#include "vec/common/pod_array.h"
+#include "vec/common/string_ref.h"
+#include "vec/core/column_with_type_and_name.h"
+#include "vec/core/field.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type_decimal.h"
+#include "vec/data_types/data_type_factory.hpp"

Review Comment:
   warning: duplicate include [readability-duplicate-include]
   
   be/src/service/arrow_flight/flight_sql_service.cpp:52:
   ```diff
   - #include "vec/data_types/data_type_decimal.h"
   - #include "vec/data_types/data_type_factory.hpp"
   + #include "vec/data_types/data_type_decimal.h"
   ```
   



##########
be/src/service/arrow_flight/arrow_flight_update.cpp:
##########
@@ -0,0 +1,59 @@
+// 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.
+
+#include "service/arrow_flight/arrow_flight_update.h"
+
+#include <arrow/status.h>
+
+#include "arrow/builder.h"
+#include "runtime/exec_env.h"
+#include "runtime/result_buffer_mgr.h"
+#include "util/arrow/row_batch.h"
+#include "util/arrow/utils.h"
+
+namespace doris {
+namespace flight {

Review Comment:
   warning: nested namespaces can be concatenated 
[modernize-concat-nested-namespaces]
   
   ```suggestion
   namespace doris::flight {
   ```
   
   be/src/service/arrow_flight/arrow_flight_update.cpp:57:
   ```diff
   - } // namespace flight
   - } // namespace doris
   + } // namespace doris
   ```
   



##########
be/src/service/arrow_flight/flight_sql_service.cpp:
##########
@@ -17,14 +17,42 @@
 
 #include "service/arrow_flight/flight_sql_service.h"
 
+#include <algorithm>
+#include <random>
 #include <arrow/status.h>
+#include <cctz/time_zone.h>
 
 #include "arrow/flight/sql/server.h"
 #include "service/arrow_flight/arrow_flight_batch_reader.h"
+#include "service/arrow_flight/arrow_flight_update.h"
 #include "service/arrow_flight/flight_sql_info.h"
 #include "service/backend_options.h"
 #include "util/arrow/utils.h"
 #include "util/uid_util.h"
+#include "util/timezone_utils.h"
+#include "vec/columns/column.h"
+#include "vec/utils/arrow_column_to_doris_column.h"
+#include "vec/data_types/data_type_decimal.h"
+#include "vec/data_types/data_type_factory.hpp"
+#include "vec/aggregate_functions/aggregate_function.h"
+
+#include "runtime/types.h"
+#include "util/binary_cast.hpp"
+#include "vec/aggregate_functions/aggregate_function.h"
+#include "vec/columns/column.h"

Review Comment:
   warning: duplicate include [readability-duplicate-include]
   
   be/src/service/arrow_flight/flight_sql_service.cpp:40:
   ```diff
   - #include "vec/aggregate_functions/aggregate_function.h"
   - #include "vec/columns/column.h"
   + #include "vec/aggregate_functions/aggregate_function.h"
   ```
   



##########
be/src/service/arrow_flight/arrow_flight_update.h:
##########
@@ -0,0 +1,66 @@
+// 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.
+
+#pragma once
+
+#include <gen_cpp/Types_types.h>
+
+#include <memory>
+
+#include "arrow/record_batch.h"
+
+namespace doris {
+namespace flight {

Review Comment:
   warning: nested namespaces can be concatenated 
[modernize-concat-nested-namespaces]
   
   ```suggestion
   namespace doris::flight {
   ```
   
   be/src/service/arrow_flight/arrow_flight_update.h:64:
   ```diff
   - } // namespace flight
   - } // namespace doris
   + } // namespace doris
   ```
   



##########
be/src/service/arrow_flight/flight_sql_service.cpp:
##########
@@ -17,14 +17,42 @@
 
 #include "service/arrow_flight/flight_sql_service.h"
 
+#include <algorithm>
+#include <random>
 #include <arrow/status.h>
+#include <cctz/time_zone.h>
 
 #include "arrow/flight/sql/server.h"
 #include "service/arrow_flight/arrow_flight_batch_reader.h"
+#include "service/arrow_flight/arrow_flight_update.h"
 #include "service/arrow_flight/flight_sql_info.h"
 #include "service/backend_options.h"
 #include "util/arrow/utils.h"
 #include "util/uid_util.h"
+#include "util/timezone_utils.h"
+#include "vec/columns/column.h"
+#include "vec/utils/arrow_column_to_doris_column.h"
+#include "vec/data_types/data_type_decimal.h"
+#include "vec/data_types/data_type_factory.hpp"
+#include "vec/aggregate_functions/aggregate_function.h"
+
+#include "runtime/types.h"
+#include "util/binary_cast.hpp"
+#include "vec/aggregate_functions/aggregate_function.h"
+#include "vec/columns/column.h"
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_decimal.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/columns/column_string.h"
+#include "vec/columns/column_vector.h"
+#include "vec/common/pod_array.h"
+#include "vec/common/string_ref.h"
+#include "vec/core/column_with_type_and_name.h"
+#include "vec/core/field.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type_decimal.h"

Review Comment:
   warning: duplicate include [readability-duplicate-include]
   
   be/src/service/arrow_flight/flight_sql_service.cpp:51:
   ```diff
   - #include "vec/core/types.h"
   - #include "vec/data_types/data_type_decimal.h"
   + #include "vec/core/types.h"
   ```
   



##########
be/src/service/arrow_flight/flight_sql_service.cpp:
##########
@@ -72,6 +103,205 @@
 
         return std::make_unique<arrow::flight::RecordBatchStream>(reader);
     }
+
+    arrow::Result<int64_t> DoPutCommandStatementUpdate(
+        const arrow::flight::ServerCallContext& context,
+        const arrow::flight::sql::StatementUpdate& command) {
+    const std::string& sql = command.query;
+    ARROW_ASSIGN_OR_RAISE(auto statement, ArrowFlightUpdate::Create(sql));
+    return statement->ExecuteUpdate();
+  }
+
+    arrow::Result<int64_t> DoPutPreparedStatementUpdate(
+        const arrow::flight::ServerCallContext& context, const 
arrow::flight::sql::PreparedStatementUpdate& command,
+        arrow::flight::FlightMessageReader* reader) {
+
+        _cnt++;
+
+        ARROW_ASSIGN_OR_RAISE(auto statement, 
ArrowFlightUpdate::Create("update"));
+        
+        while (true) {
+            cctz::time_zone ctzz;
+            TimezoneUtils::find_cctz_time_zone("UTC", ctzz);
+
+            ARROW_ASSIGN_OR_RAISE(arrow::flight::FlightStreamChunk chunk, 
reader->Next());
+            if (chunk.data == nullptr) break;
+
+            const int64_t num_rows = chunk.data->num_rows();
+            if (num_rows == 0) continue;
+            // LOG(INFO) << "wuwenchi xxxx chunk.data.num_rows: " << num_rows;
+
+            // statement->SetParameters(std::move(chunk.data));
+            // 
ARROW_RETURN_NOT_OK(statement->SetParameters({std::move(chunk.data)}));
+
+            std::vector<std::shared_ptr<arrow::RecordBatch>> datas;
+            datas.push_back(std::move(chunk.data));
+            auto end = std::remove_if(
+                datas.begin(), datas.end(),
+                [](const std::shared_ptr<arrow::RecordBatch>& batch) { return 
batch->num_rows() == 0; });
+            datas.erase(end, datas.end());
+
+            clock_t t1 = clock();
+            int batch_size = datas.size();
+            for (int i=0; i<batch_size; i++)
+            {
+                arrow::RecordBatch& batch = *datas[i];
+                // 列个数
+                int num_rows = batch.num_rows();
+                int num_columns = batch.num_columns();
+                // LOG(INFO) << "wuwenchi xxxx batch.num_rows:" << num_rows;
+                // LOG(INFO) << "wuwenchi xxxx batch.num_columns:" << 
num_columns;
+                for (int c = 0; c < num_columns; ++c) {
+                    arrow::Array* column = batch.column(c).get();
+                    
+                    auto pt = 
doris::vectorized::arrow_type_to_primitive_type(column->type_id());
+                    vectorized::DataTypePtr data_type = 
vectorized::DataTypeFactory::instance().create_data_type(pt, true);
+                    vectorized::MutableColumnPtr data_column = 
data_type->create_column();
+                    vectorized::ColumnWithTypeAndName 
column_with_name(std::move(data_column), data_type, "test_numeric_column");
+
+                    Status st = 
doris::vectorized::arrow_column_to_doris_column(column, 0, 
column_with_name.column, column_with_name.type, num_rows, ctzz);
+
+                    // for (int k=0; k<num_rows; k++) {
+                    //     LOG(INFO) << "wuwenchi xxxx 
column_with_name.to_string : " << k << ": " << column_with_name.to_string(k);
+                    // }
+                }
+            }
+
+            clock_t t2 = clock();
+            _clock += (t2 - t1);
+            // LOG(INFO) << "wuwenchi xxxx time: " << t2 - t1;
+            
+
+            // {
+            //     arrow::RecordBatch& batch = *datas[0];
+            //     // 列个数
+            //     int num_rows = batch.num_rows();
+            //     int num_columns = batch.num_columns();
+            //     LOG(INFO) << "wuwenchi xxxx batch.num_rows:" << num_rows;
+            //     LOG(INFO) << "wuwenchi xxxx batch.num_columns:" << 
num_columns;
+            //     for (int c = 0; c < num_columns; ++c) {
+            //         arrow::Array* column = batch.column(c).get();
+                    
+            //         auto pt = 
doris::vectorized::arrow_type_to_primitive_type(column->type_id());
+            //         vectorized::DataTypePtr data_type = 
vectorized::DataTypeFactory::instance().create_data_type(pt, true);
+            //         vectorized::MutableColumnPtr data_column = 
data_type->create_column();
+            //         vectorized::ColumnWithTypeAndName 
column_with_name(std::move(data_column), data_type, "test_numeric_column");
+
+            //         Status st = 
doris::vectorized::arrow_column_to_doris_column(column, 0, 
column_with_name.column, column_with_name.type, num_rows, ctzz);
+
+            //         for (int i=0; i<num_rows; i++) {
+            //             LOG(INFO) << "wuwenchi xxxx 
column_with_name.to_string : " << i << ": " << column_with_name.to_string(i);
+            //         }
+            //     }
+            // }
+
+            // for (int i = 0; i < num_rows; ++i) {
+
+            //     arrow::RecordBatch& batch = *datas[0];
+
+            //     int nums = batch.num_columns();
+            //     for (int c = 0; c < nums; ++c) {
+            //         arrow::Array* column = batch.column(c).get();
+                    
+            //         auto pt = 
doris::vectorized::arrow_type_to_primitive_type(column->type_id());
+            //         vectorized::DataTypePtr data_type = 
vectorized::DataTypeFactory::instance().create_data_type(pt, true);
+            //         vectorized::MutableColumnPtr data_column = 
data_type->create_column();
+            //         vectorized::ColumnWithTypeAndName 
column_with_name(std::move(data_column), data_type, "test_numeric_column");
+            //         // 
static_cast<void>(doris::vectorized::arrow_column_to_doris_column(
+            //         // column, 
+            //         // 0, 
+            //         // column_with_name.column,
+            //         // column_with_name.type,
+            //         // 13,
+            //         // ctzz));
+            //         Status st = 
doris::vectorized::arrow_column_to_doris_column(column, 0, 
column_with_name.column, column_with_name.type, 13, ctzz);
+            //         std::cout << st << std::endl;
+                    
+            //     }
+            // }
+
+                // 
ARROW_RETURN_NOT_OK(statement->SetParameters({std::move(chunk.data)}));
+                // for (int i = 0; i < num_rows; ++i) {
+                // if (sqlite3_clear_bindings(stmt) != SQLITE_OK) {
+                //     return Status::Invalid("Failed to reset bindings on row 
", i, ": ",
+                //                         sqlite3_errmsg(statement->db()));
+                // }
+                // // batch_index is always 0 since we're calling SetParameters
+                // // with a single batch at a time
+                // ARROW_RETURN_NOT_OK(statement->Bind(/*batch_index=*/0, i));
+                // ARROW_RETURN_NOT_OK(callback());
+                // }
+        
+            break;
+        }
+        return 10;
+    }
+
+    arrow::Result<arrow::flight::sql::ActionCreatePreparedStatementResult> 
CreatePreparedStatement(
+            const arrow::flight::ServerCallContext& context,
+            const arrow::flight::sql::ActionCreatePreparedStatementRequest& 
request) {
+
+        LOG(INFO) << "CreatePreparedStatement";
+
+        std::string handle = GenerateRandomString();
+        arrow::FieldVector parameter_fields;
+        // {
+        //     parameter_fields.push_back(arrow::field("id", arrow::int32()));
+        //     parameter_fields.push_back(arrow::field("val", arrow::int32()));
+        // }
+        
+            parameter_fields.push_back(arrow::field("id", arrow::int32()));
+            parameter_fields.push_back(arrow::field("val", arrow::utf8()));
+            parameter_fields.push_back(arrow::field("val2", arrow::utf8()));
+        
+        std::shared_ptr<arrow::Schema> parameter_schema = 
arrow::schema(parameter_fields);
+
+        return arrow::flight::sql::ActionCreatePreparedStatementResult{
+            parameter_schema, parameter_schema, std::move(handle)};
+    }
+
+    std::default_random_engine gen_;
+
+    std::string GenerateRandomString() {
+        uint32_t length = 16;
+
+        // MSVC doesn't support char types here
+        std::uniform_int_distribution<uint16_t> 
dist(static_cast<uint16_t>('0'),
+                                                    
static_cast<uint16_t>('Z'));
+        std::string ret(length, 0);
+        // Don't generate symbols to simplify parsing in DecodeTransactionQuery
+        auto get_random_char = [&]() {
+        char res;
+        while (true) {
+            res = static_cast<char>(dist(gen_));
+            if (res <= '9' || res >= 'A') break;
+        }
+        return res;

Review Comment:
   warning: statement should be inside braces 
[readability-braces-around-statements]
   
   ```suggestion
   'A') { break;
   }
   ;
   ```
   



-- 
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: commits-unsubscr...@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to