@@ -1695,9 +1695,16 @@ impl FlatFiles {
16951695 None => table_metadata. field_titles . push ( row. field_name . clone ( ) ) ,
16961696 }
16971697
1698+ let mut string_field = false ;
1699+
16981700 match row. field_type {
16991701 Some ( field_type) => {
17001702 table_metadata. supplied_types . push ( field_type. clone ( ) ) ;
1703+ match field_type. as_str ( ) {
1704+ "string" => string_field = true ,
1705+ "text" => string_field = true ,
1706+ _ => { }
1707+ }
17011708 #[ cfg( not( target_family = "wasm" ) ) ]
17021709 match field_type. as_str ( ) {
17031710 "boolean" => table_metadata
@@ -1723,8 +1730,13 @@ impl FlatFiles {
17231730 }
17241731 }
17251732
1733+ let mut link_field = false ;
1734+ if !self . options . no_link && row. field_name . starts_with ( "_link" ) {
1735+ link_field = true ;
1736+ }
1737+
17261738 let options = DescriberOptions :: builder ( )
1727- . force_string ( ! self . options . no_link && row . field_name . starts_with ( "_link" ) )
1739+ . force_string ( link_field || string_field )
17281740 . stats ( self . options . stats && self . options . threads == 1 )
17291741 . build ( ) ;
17301742
@@ -4487,6 +4499,11 @@ mod tests {
44874499 test_output ( "fixtures/basic.json" , vec ! [ ] , json ! ( { "all_strings" : true } ) )
44884500 }
44894501
4502+ #[ test]
4503+ fn test_only_null_field ( ) {
4504+ test_output ( "fixtures/only_null_field.json" , vec ! [ ] , json ! ( { "fields_only" : false , "fields_csv" : "fixtures/only_null_fields.csv" } ) )
4505+ }
4506+
44904507 #[ test]
44914508 fn test_s3_input ( ) {
44924509 if std:: env:: var ( "AWS_DEFAULT_REGION" ) . is_ok ( ) {
0 commit comments