bert-beyondloops opened a new issue, #16704: URL: https://github.com/apache/datafusion/issues/16704
### Describe the bug The output schema of the CopyTo logical plan currently directly outputs the underlying schema of it's child. The physical plan however always returns a 1 row/column count which represents the number of affected rows. This is inconsistent. ### To Reproduce Following test fails : ``` #[tokio::test] async fn test_copy_schema() -> Result<()> { let tmp_dir = TempDir::new()?; let session_state = SessionStateBuilder::new_with_default_features().build(); let session_ctx = SessionContext::new_with_state(session_state); let schema = Arc::new(Schema::new(vec![Field::new("a", DataType::Int64, true)])); // Create and register the source table with the provided schema and data let source_table = Arc::new(MemTable::try_new(schema.clone(), vec![vec![]])?); session_ctx.register_table("source_table", source_table.clone())?; let target_path = tmp_dir.path().join("target.csv"); let query = format!( "COPY source_table TO '{:?}' STORED AS csv", target_path.to_str().unwrap() ); let result = session_ctx.sql(&query).await?; assert_logical_expr_schema_eq_physical_expr_schema(result).await?; Ok(()) } ``` The schema of the physical output is not the same as the logical plan. ### Expected behavior The CopyTo logical plan returns the same schema as the physical plan, being a 1 column named "count" ### Additional context _No response_ -- 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: github-unsubscr...@datafusion.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org