Samyak2 commented on code in PR #20500:
URL: https://github.com/apache/datafusion/pull/20500#discussion_r3005938070


##########
datafusion/physical-plan/src/common.rs:
##########
@@ -204,6 +205,31 @@ pub fn can_project(
     }
 }
 
+/// Return a new `RecordBatch` with [`StringViewArray::gc`] called on such 
columns (if any).
+pub(crate) fn gc_stringview_arrays(
+    batch: RecordBatch,
+) -> Result<RecordBatch, ArrowError> {
+    let mut new_columns: Vec<Arc<dyn Array>> = 
Vec::with_capacity(batch.num_columns());
+
+    let mut arr_mutated = false;
+    for array in batch.columns() {
+        if let Some(string_view_array) = 
array.as_any().downcast_ref::<StringViewArray>()
+        {
+            let new_array = string_view_array.gc();

Review Comment:
   Interesting. I see that 
[here](https://github.com/Samyak2/arrow-rs/blob/c194e54dc4e8fcd8b9333eea2528d5db1c1ba912/arrow-select/src/coalesce/byte_view.rs#L293-L296).
 Repartition does use the batch coalescer, but on the _receiver_ side, not the 
sender side. Memory tracking happens on the sender, before coalesce.
   
   @Dandandan mentioned 
[above](https://github.com/apache/datafusion/pull/20500#discussion_r2994638863) 
that coalescing before sending had mixed results. I can try re-doing that on 
latest main to see if it still has the same effect. If so, I'll try branching 
out from the [morsel PR](https://github.com/apache/datafusion/pull/20481) and 
try it out.



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