comphead commented on code in PR #9508:
URL: https://github.com/apache/arrow-datafusion/pull/9508#discussion_r1517977082


##########
datafusion/physical-plan/src/windows/bounded_window_agg_exec.rs:
##########
@@ -378,12 +380,16 @@ trait PartitionSearcher: Send {
                 let partition_batch_state = partition_buffers
                     .entry(partition_row)
                     .or_insert_with(|| PartitionBatchState {
-                        record_batch: 
RecordBatch::new_empty(partition_batch.schema()),
+                        // Use input_schema, for the buffer schema.
+                        // record_batch.schema may not have necessary schema, 
in terms of
+                        // nullability constraints of the output.
+                        // See issue: 
https://github.com/apache/arrow-datafusion/issues/9320
+                        record_batch: 
RecordBatch::new_empty(self.input_schema().clone()),
                         is_end: false,
                         n_out_row: 0,
                     });
                 partition_batch_state.record_batch = concat_batches(
-                    &partition_batch.schema(),
+                    self.input_schema(),

Review Comment:
   👍



##########
datafusion/sqllogictest/test_files/window.slt:
##########
@@ -4269,3 +4269,12 @@ LIMIT 5;
 3 53
 24 31
 14 94
+
+query T rowsort

Review Comment:
   ```suggestion
   # Tests schema and data are in sync for mixed nulls and not nulls values for 
builtin window function
   query T rowsort
   ```



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

Reply via email to