@@ -439,7 +439,9 @@ impl<'a, W: Write> Writer<'a, W> {
439439
440440 let mut metadata = HashMap :: with_capacity ( 2 ) ;
441441 metadata. insert ( "avro.schema" , Value :: Bytes ( schema_bytes) ) ;
442- metadata. insert ( "avro.codec" , self . codec . into ( ) ) ;
442+ if self . codec != Codec :: Null {
443+ metadata. insert ( "avro.codec" , self . codec . into ( ) ) ;
444+ }
443445 match self . codec {
444446 #[ cfg( feature = "bzip" ) ]
445447 Codec :: Bzip2 ( settings) => {
@@ -865,7 +867,7 @@ mod tests {
865867 let mut writer = Writer :: new ( & schema, Vec :: new ( ) ) ?;
866868 writer. flush ( ) ?;
867869 let result = writer. into_inner ( ) ?;
868- assert_eq ! ( result. len( ) , 163 ) ;
870+ assert_eq ! ( result. len( ) , 147 ) ;
869871
870872 // Unless the user indicates via the builder that the header has already been written
871873 let mut writer = Writer :: builder ( )
@@ -1341,7 +1343,7 @@ mod tests {
13411343 writer. flush ( ) ?;
13421344 let result = writer. into_inner ( ) ?;
13431345
1344- assert_eq ! ( result. len( ) , 260 ) ;
1346+ assert_eq ! ( result. len( ) , 244 ) ;
13451347
13461348 Ok ( ( ) )
13471349 }
@@ -1617,7 +1619,7 @@ mod tests {
16171619
16181620 let bytes = writer. append_ser ( conf) ?;
16191621
1620- assert_eq ! ( 198 , bytes) ;
1622+ assert_eq ! ( 182 , bytes) ;
16211623
16221624 Ok ( ( ) )
16231625 }
@@ -1707,7 +1709,7 @@ mod tests {
17071709
17081710 assert_eq ! (
17091711 shared_buffer. len( ) ,
1710- 167 ,
1712+ 151 ,
17111713 "the test buffer was not fully written to after Writer::flush was called"
17121714 ) ;
17131715
0 commit comments