Ilhan-Personal opened a new issue, #27824:
URL: https://github.com/apache/datafusion/issues/27824
### Describe the bug
On DataFusion 56.0.0, `COPY TO CSV` produces different output depending on
whether the logical plan is executed directly or serialized and deserialized
first. After a protobuf round trip, the writer adds a header and quotes every
field despite `format.has_header = false` and `format.quote_style = Never`.
### To Reproduce
This reproduces with `datafusion` and `datafusion-proto` alone. Run the
following in an async Rust test:
```rust
use datafusion::prelude::SessionContext;
use datafusion_proto::bytes::{logical_plan_from_bytes,
logical_plan_to_bytes};
let ctx = SessionContext::new();
let dir = tempfile::tempdir()?;
let path = dir.path().join("out.csv");
let sql = format!(
"COPY (SELECT 1 AS id, 'hello' AS s) TO '{}' STORED AS CSV
OPTIONS ('format.has_header' 'false', 'format.quote_style' 'Never')",
path.display()
);
let plan = ctx.state().create_logical_plan(&sql).await?;
let bytes = logical_plan_to_bytes(&plan)?;
let decoded = logical_plan_from_bytes(&bytes, &ctx.task_ctx())?;
ctx.execute_logical_plan(plan).await?.collect().await?;
let direct = std::fs::read_to_string(&path)?;
std::fs::remove_file(&path)?;
ctx.execute_logical_plan(decoded).await?.collect().await?;
let roundtrip = std::fs::read_to_string(&path)?;
assert_eq!(roundtrip, direct);
```
### Expected behavior
Both executions should write the same CSV. Direct execution writes:
```csv
1,hello
```
### Actual behavior
Executing the decoded plan writes:
```csv
"id","s"
"1","hello"
```
### Additional context
_No response_
### Willingness to contribute
I plan to contribute a fix for this bug independently
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]