xudong963 commented on code in PR #20922:
URL: https://github.com/apache/datafusion/pull/20922#discussion_r2963962340
##########
datafusion/physical-plan/src/sorts/builder.rs:
##########
@@ -126,49 +129,97 @@ impl BatchBuilder {
&self.schema
}
+ /// Try to interleave all columns using the given index slice.
+ fn try_interleave_columns(
+ &self,
+ indices: &[(usize, usize)],
+ ) -> Result<Vec<Arc<dyn arrow::array::Array>>> {
+ (0..self.schema.fields.len())
+ .map(|column_idx| {
+ let arrays: Vec<_> = self
+ .batches
+ .iter()
+ .map(|(_, batch)| batch.column(column_idx).as_ref())
+ .collect();
+ // Arrow's interleave panics on i32 offset overflow with
+ // `.expect("overflow")`. Catch that panic so the caller
+ // can retry with fewer rows.
+ match catch_unwind(AssertUnwindSafe(|| interleave(&arrays,
indices))) {
+ Ok(result) => Ok(result?),
+ Err(panic_payload) => {
+ if is_overflow_panic(&panic_payload) {
Review Comment:
good point, totally agree
--
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]