@@ -7,10 +7,8 @@ use arrow_array::{
77use arrow_schema:: { DataType , Field , FieldRef , Schema as ArrowSchema } ;
88use criterion:: { criterion_group, criterion_main, Criterion } ;
99
10- use lance:: {
11- arrow:: FixedSizeListArrayExt ,
12- dataset:: { builder:: DatasetBuilder , ProjectionRequest } ,
13- } ;
10+ use lance:: dataset:: { Dataset , WriteMode , WriteParams } ;
11+ use lance:: { arrow:: FixedSizeListArrayExt , dataset:: ProjectionRequest } ;
1412use lance_file:: version:: LanceFileVersion ;
1513#[ cfg( target_os = "linux" ) ]
1614use pprof:: criterion:: { Output , PProfProfiler } ;
@@ -19,8 +17,6 @@ use std::sync::Arc;
1917#[ cfg( target_os = "linux" ) ]
2018use std:: time:: Duration ;
2119
22- use lance:: dataset:: { Dataset , WriteMode , WriteParams } ;
23-
2420const BATCH_SIZE : u64 = 1024 ;
2521
2622fn gen_ranges ( num_rows : u64 , file_size : u64 , n : usize ) -> Vec < u64 > {
@@ -92,25 +88,6 @@ async fn create_dataset(
9288 num_batches : i32 ,
9389 file_size : i32 ,
9490) -> Dataset {
95- create_file (
96- std:: path:: Path :: new ( path) ,
97- WriteMode :: Create ,
98- data_storage_version,
99- num_batches,
100- file_size,
101- )
102- . await ;
103-
104- DatasetBuilder :: from_uri ( path) . load ( ) . await . unwrap ( )
105- }
106-
107- async fn create_file (
108- path : & std:: path:: Path ,
109- mode : WriteMode ,
110- data_storage_version : LanceFileVersion ,
111- num_batches : i32 ,
112- file_size : i32 ,
113- ) {
11491 let schema = Arc :: new ( ArrowSchema :: new ( vec ! [
11592 Field :: new( "i" , DataType :: Int32 , false ) ,
11693 Field :: new( "f" , DataType :: Float32 , false ) ,
@@ -163,18 +140,17 @@ async fn create_file(
163140 } )
164141 . collect ( ) ;
165142
166- let test_uri = path. to_str ( ) . unwrap ( ) ;
167143 let write_params = WriteParams {
168144 max_rows_per_file : file_size as usize ,
169145 max_rows_per_group : batch_size as usize ,
170- mode,
146+ mode : WriteMode :: Create ,
171147 data_storage_version : Some ( data_storage_version) ,
172148 ..Default :: default ( )
173149 } ;
174150 let reader = RecordBatchIterator :: new ( batches. into_iter ( ) . map ( Ok ) , schema. clone ( ) ) ;
175- Dataset :: write ( reader, test_uri , Some ( write_params) )
151+ Dataset :: write ( reader, path , Some ( write_params) )
176152 . await
177- . unwrap ( ) ;
153+ . unwrap ( )
178154}
179155
180156#[ cfg( target_os = "linux" ) ]
0 commit comments