1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- #include < benchmark/benchmark.h>
16- #include < glog/logging.h>
1715#include < arrow/builder.h>
1816#include < arrow/io/file.h>
1917#include < arrow/ipc/writer.h>
18+ #include < benchmark/benchmark.h>
19+ #include < glog/logging.h>
2020
2121#include < filesystem>
2222#include < fstream>
2323#include < memory>
2424#include < utility>
2525#include < vector>
2626
27+ #include " column/chunk.h"
2728#include " exec/file_scanner/arrow_scanner.h"
2829#include " exec/file_scanner/json_scanner.h"
30+ #include " gen_cpp/Descriptors_types.h"
2931#include " runtime/descriptors.h"
3032#include " runtime/exec_env.h"
31- #include " runtime/runtime_state.h"
3233#include " runtime/mem_tracker.h"
33- #include " column/chunk .h"
34+ #include " runtime/runtime_state .h"
3435#include " types/type_descriptor.h"
35- #include " gen_cpp/Descriptors_types.h"
3636
3737namespace starrocks {
3838
@@ -56,8 +56,7 @@ static void generate_test_files(const std::string& arrow_path, const std::string
5656 (void )str_builder.Finish (&str_array);
5757 (void )double_builder.Finish (&double_array);
5858
59- auto schema = arrow::schema ({arrow::field (" c0_int" , arrow::int32 ()),
60- arrow::field (" c1_str" , arrow::utf8 ()),
59+ auto schema = arrow::schema ({arrow::field (" c0_int" , arrow::int32 ()), arrow::field (" c1_str" , arrow::utf8 ()),
6160 arrow::field (" c2_double" , arrow::float64 ())});
6261
6362 auto batch = arrow::RecordBatch::Make (schema, num_rows, {int_array, str_array, double_array});
@@ -84,16 +83,15 @@ static void generate_test_files(const std::string& arrow_path, const std::string
8483 LOG (FATAL ) << " Failed to open JSON file for writing: " << json_path;
8584 }
8685 for (int64_t i = 0 ; i < num_rows; ++i) {
87- json_file << " {\" c0_int\" :" << i
88- << " ,\" c1_str\" :\" varchar_str_" << (i % 100 )
86+ json_file << " {\" c0_int\" :" << i << " ,\" c1_str\" :\" varchar_str_" << (i % 100 )
8987 << " \" ,\" c2_double\" :" << (static_cast <double >(i) * 1.5 ) << " }\n " ;
9088 }
9189 json_file.close ();
9290}
9391
9492static DescriptorTbl* create_descriptor_table (RuntimeState* state, ObjectPool* pool) {
9593 TDescriptorTable thrift_tbl;
96-
94+
9795 // Source Tuple (id = 0)
9896 TTupleDescriptor src_tuple;
9997 src_tuple.id = 0 ;
@@ -109,10 +107,9 @@ static DescriptorTbl* create_descriptor_table(RuntimeState* state, ObjectPool* p
109107 thrift_tbl.tupleDescriptors .push_back (dest_tuple);
110108
111109 std::vector<std::pair<std::string, TypeDescriptor>> columns = {
112- {" c0_int" , TypeDescriptor::from_logical_type (TYPE_INT )},
113- {" c1_str" , TypeDescriptor::from_logical_type (TYPE_VARCHAR )},
114- {" c2_double" , TypeDescriptor::from_logical_type (TYPE_DOUBLE )}
115- };
110+ {" c0_int" , TypeDescriptor::from_logical_type (TYPE_INT )},
111+ {" c1_str" , TypeDescriptor::from_logical_type (TYPE_VARCHAR )},
112+ {" c2_double" , TypeDescriptor::from_logical_type (TYPE_DOUBLE )}};
116113
117114 int slot_id = 0 ;
118115 for (int i = 0 ; i < columns.size (); ++i) {
@@ -153,8 +150,8 @@ static DescriptorTbl* create_descriptor_table(RuntimeState* state, ObjectPool* p
153150 return desc_tbl;
154151}
155152
156- static TBrokerScanRange* create_scan_range (ObjectPool* pool, const std::string& path,
157- TFileFormatType::type format_type, DescriptorTbl* desc_tbl) {
153+ static TBrokerScanRange* create_scan_range (ObjectPool* pool, const std::string& path, TFileFormatType::type format_type,
154+ DescriptorTbl* desc_tbl) {
158155 TBrokerScanRangeParams* params = pool->add (new TBrokerScanRangeParams ());
159156 params->strict_mode = true ;
160157 params->src_tuple_id = 0 ;
0 commit comments