Skip to content
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

CSV quote parameter is ignored #10670

Closed
DDtKey opened this issue May 25, 2024 · 0 comments · Fixed by #10671
Closed

CSV quote parameter is ignored #10670

DDtKey opened this issue May 25, 2024 · 0 comments · Fixed by #10671
Labels
bug Something isn't working

Comments

@DDtKey
Copy link
Contributor

DDtKey commented May 25, 2024

Describe the bug

quote parameter of CSV writer is not passed to arrow-csv writer:

impl TryFrom<&CsvOptions> for CsvWriterOptions {
type Error = DataFusionError;
fn try_from(value: &CsvOptions) -> Result<Self> {
let mut builder = WriterBuilder::default()
.with_header(value.has_header.unwrap_or(false))
.with_delimiter(value.delimiter);
if let Some(v) = &value.date_format {
builder = builder.with_date_format(v.into())
}
if let Some(v) = &value.datetime_format {
builder = builder.with_datetime_format(v.into())
}
if let Some(v) = &value.timestamp_format {
builder = builder.with_timestamp_format(v.into())
}
if let Some(v) = &value.time_format {
builder = builder.with_time_format(v.into())
}
if let Some(v) = &value.null_value {
builder = builder.with_null(v.into())
}
Ok(CsvWriterOptions {
writer_options: builder,
compression: value.compression,
})
}

To Reproduce

COPY (select '12,3', 'abc,d' ) TO 'test.csv' STORED AS csv OPTIONS ('quote' '|')

results in

"Utf8(""12,3"")","Utf8(""abc,d"")"
"12,3","abc,d"

Result is the same if we use write_csv with passed option

Expected behavior

Writer should use appropriate quote char.

Additional context

No response

@DDtKey DDtKey added the bug Something isn't working label May 25, 2024
DDtKey added a commit to DDtKey/arrow-datafusion that referenced this issue May 25, 2024
alamb pushed a commit that referenced this issue May 26, 2024
jayzhan211 pushed a commit to jayzhan211/arrow-datafusion that referenced this issue May 26, 2024
svranesevic pushed a commit to coralogix/arrow-datafusion that referenced this issue Jun 8, 2024
findepi pushed a commit to findepi/datafusion that referenced this issue Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant