@@ -37,13 +37,6 @@ pub struct CsvWriterOptions {
3737 /// Compression to apply after ArrowWriter serializes RecordBatches.
3838 /// This compression is applied by DataFusion not the ArrowWriter itself.
3939 pub compression : CompressionTypeVariant ,
40- /// Indicates whether WriterBuilder.has_header() is set to true.
41- /// This is duplicative as WriterBuilder also stores this information.
42- /// However, WriterBuilder does not allow public read access to the
43- /// has_header parameter.
44- pub has_header : bool ,
45- // TODO: expose a way to read has_header in arrow create
46- // https://github.com/apache/arrow-rs/issues/4735
4740}
4841
4942impl CsvWriterOptions {
@@ -54,7 +47,6 @@ impl CsvWriterOptions {
5447 Self {
5548 writer_options,
5649 compression,
57- has_header : true ,
5850 }
5951 }
6052}
@@ -65,29 +57,20 @@ impl TryFrom<(&ConfigOptions, &StatementOptions)> for CsvWriterOptions {
6557 fn try_from ( value : ( & ConfigOptions , & StatementOptions ) ) -> Result < Self > {
6658 let _configs = value. 0 ;
6759 let statement_options = value. 1 ;
68- let mut has_header = true ;
6960 let mut builder = WriterBuilder :: default ( ) ;
7061 let mut compression = CompressionTypeVariant :: UNCOMPRESSED ;
7162 for ( option, value) in & statement_options. options {
7263 builder = match option. to_lowercase ( ) . as_str ( ) {
7364 "header" => {
74- has_header = value. parse ( )
65+ let has_header = value. parse ( )
7566 . map_err ( |_| DataFusionError :: Configuration ( format ! ( "Unable to parse {value} as bool as required for {option}!" ) ) ) ?;
76- builder. has_headers ( has_header)
67+ builder. with_header ( has_header)
7768 } ,
7869 "date_format" => builder. with_date_format ( value. to_owned ( ) ) ,
7970 "datetime_format" => builder. with_datetime_format ( value. to_owned ( ) ) ,
8071 "timestamp_format" => builder. with_timestamp_format ( value. to_owned ( ) ) ,
8172 "time_format" => builder. with_time_format ( value. to_owned ( ) ) ,
82- "rfc3339" => {
83- let value_bool = value. parse ( )
84- . map_err ( |_| DataFusionError :: Configuration ( format ! ( "Unable to parse {value} as bool as required for {option}!" ) ) ) ?;
85- if value_bool{
86- builder. with_rfc3339 ( )
87- } else {
88- builder
89- }
90- } ,
73+ "rfc3339" => builder, // No-op
9174 "null_value" => builder. with_null ( value. to_owned ( ) ) ,
9275 "compression" => {
9376 compression = CompressionTypeVariant :: from_str ( value. replace ( '\'' , "" ) . as_str ( ) ) ?;
@@ -112,7 +95,6 @@ impl TryFrom<(&ConfigOptions, &StatementOptions)> for CsvWriterOptions {
11295 }
11396 }
11497 Ok ( CsvWriterOptions {
115- has_header,
11698 writer_options : builder,
11799 compression,
118100 } )
0 commit comments