@@ -554,7 +554,10 @@ impl QueryIterator {
554554 guarantee_timestamp : 0 ,
555555 query_params : init_ts_params,
556556 not_return_all_meta : false ,
557- consistency_level : self . options . consistency_level . unwrap_or ( 0 ) ,
557+ consistency_level : self
558+ . options
559+ . consistency_level
560+ . unwrap_or ( self . consistency_level as i32 ) ,
558561 use_default_consistency : self . options . consistency_level . is_none ( ) ,
559562 expr_template_values : self . options . expr_template_values . clone ( ) ,
560563 } )
@@ -579,6 +582,7 @@ impl QueryIterator {
579582 . read ( true )
580583 . write ( true )
581584 . create ( true )
585+ . truncate ( false )
582586 . open ( cp_file_path)
583587 {
584588 self . cp_file_handler = Some ( file) ;
@@ -589,7 +593,7 @@ impl QueryIterator {
589593 let reader = BufReader :: new ( file) ;
590594 let lines: Vec < String > = reader
591595 . lines ( )
592- . map ( |line| line. map_err ( |e| Error :: Io ( e ) ) )
596+ . map ( |line| line. map_err ( Error :: Io ) )
593597 . collect :: < Result < Vec < String > > > ( ) ?;
594598
595599 if lines. len ( ) >= 2 {
@@ -708,7 +712,10 @@ impl QueryIterator {
708712 guarantee_timestamp : self . session_ts ,
709713 query_params : seek_params,
710714 not_return_all_meta : false ,
711- consistency_level : self . options . consistency_level . unwrap_or ( 0 ) ,
715+ consistency_level : self
716+ . options
717+ . consistency_level
718+ . unwrap_or ( self . consistency_level as i32 ) ,
712719 use_default_consistency : self . options . consistency_level . is_none ( ) ,
713720 expr_template_values : self . options . expr_template_values . clone ( ) ,
714721 } )
@@ -951,7 +958,10 @@ impl QueryIterator {
951958 guarantee_timestamp : self . session_ts ,
952959 query_params,
953960 not_return_all_meta : false ,
954- consistency_level : self . options . consistency_level . unwrap_or ( 0 ) ,
961+ consistency_level : self
962+ . options
963+ . consistency_level
964+ . unwrap_or ( self . consistency_level as i32 ) ,
955965 use_default_consistency : self . options . consistency_level . is_none ( ) ,
956966 expr_template_values : self . options . expr_template_values . clone ( ) ,
957967 } )
@@ -970,7 +980,7 @@ impl QueryIterator {
970980 if results. is_empty ( ) {
971981 self . has_more = false ;
972982 } else {
973- let actual_returned = results. iter ( ) . map ( |r| r. len ( ) as usize ) . sum :: < usize > ( ) ;
983+ let actual_returned = results. iter ( ) . map ( |r| r. len ( ) ) . sum :: < usize > ( ) ;
974984 if actual_returned < remaining_limit {
975985 self . has_more = false ;
976986 }
@@ -1204,6 +1214,7 @@ impl SearchIterator {
12041214 . read ( true )
12051215 . write ( true )
12061216 . create ( true )
1217+ . truncate ( false )
12071218 . open ( cp_file_path)
12081219 {
12091220 self . cp_file_handler = Some ( file) ;
@@ -1214,7 +1225,7 @@ impl SearchIterator {
12141225 let reader = BufReader :: new ( file) ;
12151226 let lines: Vec < String > = reader
12161227 . lines ( )
1217- . map ( |line| line. map_err ( |e| Error :: Io ( e ) ) )
1228+ . map ( |line| line. map_err ( Error :: Io ) )
12181229 . collect :: < Result < Vec < String > > > ( ) ?;
12191230
12201231 if lines. len ( ) >= 2 {
@@ -1389,7 +1400,10 @@ impl SearchIterator {
13891400 travel_timestamp : 0 ,
13901401 guarantee_timestamp : self . session_ts ,
13911402 not_return_all_meta : false ,
1392- consistency_level : self . options . consistency_level . unwrap_or ( 0 ) ,
1403+ consistency_level : self
1404+ . options
1405+ . consistency_level
1406+ . unwrap_or ( self . consistency_level as i32 ) ,
13931407 use_default_consistency : self . options . consistency_level . is_none ( ) ,
13941408 search_by_primary_keys : false ,
13951409 expr_template_values : self . options . expr_template_values . clone ( ) ,
@@ -1412,10 +1426,8 @@ impl SearchIterator {
14121426 self . iterator_token = Some ( iter_v2_results. token ) ;
14131427 }
14141428 self . last_bound = Some ( iter_v2_results. last_bound . to_string ( ) ) ;
1415- } else {
1416- if self . iterator_token . is_none ( ) {
1417- self . iterator_token = Some ( format ! ( "token_{}" , self . session_ts) ) ;
1418- }
1429+ } else if self . iterator_token . is_none ( ) {
1430+ self . iterator_token = Some ( format ! ( "token_{}" , self . session_ts) ) ;
14191431 }
14201432
14211433 let mut result = Vec :: new ( ) ;
0 commit comments