kosiew commented on code in PR #26274:
URL: https://github.com/apache/datafusion/pull/26274#discussion_r4453464623


##########
datafusion/expr/src/logical_plan/materialized_cte.rs:
##########
@@ -375,6 +492,113 @@ mod tests {
         Ok(())
     }
 
+    fn wide_schema() -> DFSchemaRef {
+        let schema = Schema::new(vec![
+            Field::new("a", DataType::Int32, true),
+            Field::new("b", DataType::Utf8, true),
+            Field::new("c", DataType::Float64, true),
+            Field::new("d", DataType::Boolean, true),
+        ]);
+        Arc::new(DFSchema::try_from_qualified_schema("c", &schema).unwrap())
+    }
+
+    fn names(scan: &MaterializedCteScan) -> Vec<String> {
+        scan.schema()
+            .columns()
+            .iter()
+            .map(|c| c.flat_name())
+            .collect()
+    }
+
+    #[test]
+    fn scan_projection_refers_to_the_body() -> Result<()> {

Review Comment:
   Optional: could we extend this test with field/schema metadata, mixed 
nullability, and a functional dependency whose indices change under projection? 
Please verify these attributes survive projection composition and that 
body-column remapping leaves the scan schema unchanged, since the current 
fixture has no metadata or dependencies and all fields are nullable.



##########
datafusion/physical-plan/src/materialized_cte.rs:
##########
@@ -978,6 +1059,73 @@ mod tests {
         Ok(())
     }
 
+    /// A scan with a projection outputs the selected columns of the buffered
+    /// batches. A scan that selects no column keeps the row count.
+    #[tokio::test]
+    async fn scan_projection() -> Result<()> {

Review Comment:
   Optional follow-up: could we test different nonempty projections, including 
reordered columns, over a forced-spill, multi-column body? Please assert that 
spilling occurs and verify selected values, exact batch schemas, and row counts 
after disk replay. Existing spill tests cover zero-column projection, but not 
this combination of spill serialization and scan-local projection.



-- 
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]

Reply via email to