-
Couldn't load subscription status.
- Fork 1.7k
Update arrow 48.0.0 #7854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update arrow 48.0.0 #7854
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,13 +37,6 @@ pub struct CsvWriterOptions { | |
| /// Compression to apply after ArrowWriter serializes RecordBatches. | ||
| /// This compression is applied by DataFusion not the ArrowWriter itself. | ||
| pub compression: CompressionTypeVariant, | ||
| /// Indicates whether WriterBuilder.has_header() is set to true. | ||
| /// This is duplicative as WriterBuilder also stores this information. | ||
| /// However, WriterBuilder does not allow public read access to the | ||
| /// has_header parameter. | ||
| pub has_header: bool, | ||
| // TODO: expose a way to read has_header in arrow create | ||
| // https://github.com/apache/arrow-rs/issues/4735 | ||
| } | ||
|
|
||
| impl CsvWriterOptions { | ||
|
|
@@ -54,7 +47,6 @@ impl CsvWriterOptions { | |
| Self { | ||
| writer_options, | ||
| compression, | ||
| has_header: true, | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -65,29 +57,20 @@ impl TryFrom<(&ConfigOptions, &StatementOptions)> for CsvWriterOptions { | |
| fn try_from(value: (&ConfigOptions, &StatementOptions)) -> Result<Self> { | ||
| let _configs = value.0; | ||
| let statement_options = value.1; | ||
| let mut has_header = true; | ||
| let mut builder = WriterBuilder::default(); | ||
| let mut compression = CompressionTypeVariant::UNCOMPRESSED; | ||
| for (option, value) in &statement_options.options { | ||
| builder = match option.to_lowercase().as_str(){ | ||
| "header" => { | ||
| has_header = value.parse() | ||
| let has_header = value.parse() | ||
| .map_err(|_| DataFusionError::Configuration(format!("Unable to parse {value} as bool as required for {option}!")))?; | ||
| builder.has_headers(has_header) | ||
| builder.with_header(has_header) | ||
| }, | ||
| "date_format" => builder.with_date_format(value.to_owned()), | ||
| "datetime_format" => builder.with_datetime_format(value.to_owned()), | ||
| "timestamp_format" => builder.with_timestamp_format(value.to_owned()), | ||
| "time_format" => builder.with_time_format(value.to_owned()), | ||
| "rfc3339" => { | ||
| let value_bool = value.parse() | ||
| .map_err(|_| DataFusionError::Configuration(format!("Unable to parse {value} as bool as required for {option}!")))?; | ||
| if value_bool{ | ||
| builder.with_rfc3339() | ||
| } else{ | ||
| builder | ||
| } | ||
| }, | ||
|
Comment on lines
-82
to
-90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| "rfc3339" => builder, // No-op | ||
| "null_value" => builder.with_null(value.to_owned()), | ||
| "compression" => { | ||
| compression = CompressionTypeVariant::from_str(value.replace('\'', "").as_str())?; | ||
|
|
@@ -112,7 +95,6 @@ impl TryFrom<(&ConfigOptions, &StatementOptions)> for CsvWriterOptions { | |
| } | ||
| } | ||
| Ok(CsvWriterOptions { | ||
| has_header, | ||
| writer_options: builder, | ||
| compression, | ||
| }) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -523,9 +523,9 @@ mod tests { | |
|
|
||
| let csv_options = CsvWriterOptions::try_from((&config, &options))?; | ||
| let builder = csv_options.writer_options; | ||
| assert!(builder.header()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| let buff = Vec::new(); | ||
| let _properties = builder.build(buff); | ||
| assert!(csv_options.has_header); | ||
| assert_eq!(csv_options.compression, CompressionTypeVariant::GZIP); | ||
| // TODO expand unit test if csv::WriterBuilder allows public read access to properties | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉