Skip to content

Commit 714a5a9

Browse files
committed
add log
1 parent 61455f6 commit 714a5a9

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

datafusion/physical-plan/src/sorts/builder.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ use arrow::error::ArrowError;
2222
use arrow::record_batch::RecordBatch;
2323
use datafusion_common::{DataFusionError, Result};
2424
use datafusion_execution::memory_pool::MemoryReservation;
25-
use std::panic::{catch_unwind, AssertUnwindSafe};
25+
use log::warn;
26+
use std::panic::{AssertUnwindSafe, catch_unwind};
2627
use std::sync::Arc;
2728

2829
#[derive(Debug, Copy, Clone, Default)]
@@ -248,6 +249,7 @@ impl BatchBuilder {
248249
}
249250
}
250251

252+
<<<<<<< HEAD
251253
<<<<<<< HEAD
252254
/// Try to grow `reservation` so it covers at least `needed` bytes.
253255
///
@@ -265,11 +267,14 @@ pub(crate) fn try_grow_reservation_to_at_least(
265267
Ok(())
266268
=======
267269
/// Returns `true` if the error is an Arrow offset overflow error.
270+
=======
271+
/// Returns true if the error is an Arrow offset overflow.
272+
>>>>>>> a53942d48 (add log)
268273
fn is_offset_overflow(e: &DataFusionError) -> bool {
269274
matches!(
270275
e,
271-
DataFusionError::ArrowError(err, _)
272-
if matches!(err.as_ref(), ArrowError::OffsetOverflowError(_))
276+
DataFusionError::ArrowError(boxed, _)
277+
if matches!(boxed.as_ref(), ArrowError::OffsetOverflowError(_))
273278
)
274279
>>>>>>> 967cf0a65 (Fix sort merge interleave overflow)
275280
}
@@ -290,7 +295,9 @@ mod tests {
290295
use super::*;
291296
use arrow::array::StringArray;
292297
use arrow::datatypes::{DataType, Field, Schema};
293-
use datafusion_execution::memory_pool::{MemoryConsumer, MemoryPool, UnboundedMemoryPool};
298+
use datafusion_execution::memory_pool::{
299+
MemoryConsumer, MemoryPool, UnboundedMemoryPool,
300+
};
294301

295302
/// Test that interleaving string columns whose combined byte length
296303
/// exceeds i32::MAX does not panic. Arrow's `interleave` panics with
@@ -302,11 +309,7 @@ mod tests {
302309
// Each string is ~768 MB. Three rows total → ~2.3 GB > i32::MAX.
303310
let big_str: String = "x".repeat(768 * 1024 * 1024);
304311

305-
let schema = Arc::new(Schema::new(vec![Field::new(
306-
"s",
307-
DataType::Utf8,
308-
false,
309-
)]));
312+
let schema = Arc::new(Schema::new(vec![Field::new("s", DataType::Utf8, false)]));
310313

311314
let pool: Arc<dyn MemoryPool> = Arc::new(UnboundedMemoryPool::default());
312315
let reservation = MemoryConsumer::new("test").register(&pool);
@@ -321,8 +324,7 @@ mod tests {
321324
for stream_idx in 0..3 {
322325
let array = StringArray::from(vec![big_str.as_str()]);
323326
let batch =
324-
RecordBatch::try_new(Arc::clone(&schema), vec![Arc::new(array)])
325-
.unwrap();
327+
RecordBatch::try_new(Arc::clone(&schema), vec![Arc::new(array)]).unwrap();
326328
builder.push_batch(stream_idx, batch).unwrap();
327329
builder.push_row(stream_idx);
328330
}

0 commit comments

Comments
 (0)