-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Merged
Merged
Update arrow 48.0.0 #7854
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🎉