@@ -70,8 +70,9 @@ use super::{
7070 staging:: { StagingError , reader:: MergedReverseRecordReader , writer:: Writer } ,
7171} ;
7272
73+ const DISK_WRITE_BATCH_ROWS_VAR : & str = "DISK_WRITE_BATCH_ROWS" ;
7374static DISK_WRITE_BATCH_ROWS : Lazy < usize > = Lazy :: new ( || {
74- if let Ok ( var) = std:: env:: var ( "P_DISK_WRITE_BATCH_ROWS" )
75+ if let Ok ( var) = std:: env:: var ( DISK_WRITE_BATCH_ROWS_VAR )
7576 && let Ok ( var) = var. parse :: < usize > ( )
7677 {
7778 var
@@ -449,17 +450,15 @@ impl Stream {
449450 }
450451
451452 pub fn get_schemas_if_present ( & self ) -> Result < Vec < Schema > , StagingError > {
452- let Ok ( dir) = self . data_path . read_dir ( ) else {
453- return Ok ( vec ! [ ] ) ;
454- } ;
453+ let dir = self . data_path . read_dir ( ) ?;
455454
456455 let mut schemas: Vec < Schema > = Vec :: new ( ) ;
457456
458457 for file in dir. flatten ( ) {
459458 if let Some ( ext) = file. path ( ) . extension ( )
460459 && ext. eq ( "schema" )
461460 {
462- let file = File :: open ( file. path ( ) ) . expect ( "Schema File should exist" ) ;
461+ let file = File :: open ( file. path ( ) ) ? ;
463462
464463 schemas. push ( serde_json:: from_reader ( file) ?) ;
465464 }
@@ -524,11 +523,10 @@ impl Stream {
524523 fs:: create_dir_all ( & self . data_path ) ?;
525524
526525 // need to add something before .schema to make the file have an extension of type `schema`
527- let file_name = self
528- . ingestor_id
529- . as_ref ( )
530- . map ( |id| format ! ( ".ingestor.{id}.schema" ) )
531- . unwrap_or_else ( || ".schema" . to_owned ( ) ) ;
526+ let file_name = self . ingestor_id . as_ref ( ) . map_or_else (
527+ || ".schema" . to_owned ( ) ,
528+ |id| format ! ( ".ingestor.{id}.schema" ) ,
529+ ) ;
532530 let path = RelativePathBuf :: from_iter ( [ file_name] ) . to_path ( & self . data_path ) ;
533531 let tmp_path = path. with_extension ( "schema.tmp" ) ;
534532
0 commit comments