You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "demetribu (via GitHub)" <gi...@apache.org> on 2024/11/03 19:14:49 UTC
[I] Overflow in Join Processing for Large Ranges [datafusion]
demetribu opened a new issue, #13237:
URL: https://github.com/apache/datafusion/issues/13237
### Describe the bug
The error occurs when performing an inner join on two large `unnest(range(...))` datasets in DataFusion.
```
./datafusion-cli/target/debug/datafusion-cli -m 512m
DataFusion CLI v42.2.0
set datafusion.execution.sort_spill_reservation_bytes = 104857;
0 row(s) fetched.
Elapsed 0.004 seconds.
set datafusion.execution.sort_in_place_threshold_bytes = 104857;
0 row(s) fetched.
Elapsed 0.002 seconds.
select * from (select unnest(range(0, 100000)) id) t inner join (select unnest(range(0, 100000)) id) t1 on t.id = t1.id;
thread 'tokio-runtime-worker' panicked at
.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrow-select-53.2.0/src/take.rs:773:13:
attempt to add with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
External error: External error: Join Error
caused by
External error: task 38 panicked with message "attempt to add with overflow"
```
Example was taken from [Apache DataFusion Issue #9359](https://github.com/apache/datafusion/issues/9359).
### To Reproduce
_No response_
### Expected behavior
_No response_
### Additional context
_No response_
--
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: github-unsubscribe@datafusion.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Overflow in `repeat_arrs_from_indices` [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #13237:
URL: https://github.com/apache/datafusion/issues/13237#issuecomment-2465669253
Sounds like a fun optimization exercise to figure out what is going on
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Overflow in `repeat_arrs_from_indices` [datafusion]
Posted by "demetribu (via GitHub)" <gi...@apache.org>.
demetribu commented on issue #13237:
URL: https://github.com/apache/datafusion/issues/13237#issuecomment-2465328434
```
#[test]
fn test_batch_indices_overflow() -> Result<()> {
use arrow_array::{Int64Array, ArrayRef, PrimitiveArray};
use std::sync::Arc;
let int_values: Vec<i64> = (1..=100000).collect();
let int64_array = Int64Array::from(int_values);
let mut list_builder = ListBuilder::new(Int64Array::builder(100000));
list_builder.values().append_slice(int64_array.values());
list_builder.append(true); // Mark this as a single list item in the ListArray
let list_array = Arc::new(list_builder.finish()) as ArrayRef;
let indices = Int64Array::from(vec![0i64; 100000]);
let result = repeat_arrs_from_indices(&[list_array], &indices);
assert!(
result.is_ok(),
"Expected successful result with repeated indices, but got error: {:?}",
result
);
Ok(())
}
```
Failed with:
```
thread 'unnest::tests::test_batch_indices_overflow' panicked at .cargo/registry/src/index.crates.io-6f17d22bba15001f/arrow-select-53.2.0/src/take.rs:773:13: attempt to add with overflow
```
```
#[test]
fn test_batch_indices_overflow() -> Result<()> {
use arrow::{array::{LargeListBuilder, ListBuilder}, datatypes::{Field, Int32Type}};
use arrow_array::{Int64Array, ArrayRef, PrimitiveArray};
use std::sync::Arc;
let int_values: Vec<i64> = (1..=100000).collect();
let int64_array = Int64Array::from(int_values);
let mut list_builder = LargeListBuilder::new(Int64Array::builder(100000));
list_builder.values().append_slice(int64_array.values());
list_builder.append(true); // Mark this as a single list item in the ListArray
let list_array = Arc::new(list_builder.finish()) as ArrayRef;
let indices = Int64Array::from(vec![0i64; 100000]);
let result = repeat_arrs_from_indices(&[list_array], &indices);
assert!(
result.is_ok(),
"Expected successful result with repeated indices, but got error: {:?}",
result
);
Ok(())
}
```
It works, but slow, taking 224.24 seconds.
cc @alamb
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Overflow in `repeat_arrs_from_indices` [datafusion]
Posted by "demetribu (via GitHub)" <gi...@apache.org>.
demetribu commented on issue #13237:
URL: https://github.com/apache/datafusion/issues/13237#issuecomment-2469065968
```
#[test]
fn test_array_take_sequential() {
use arrow_array::{Int64Array, ArrayRef};
use std::sync::Arc;
let int_values: Vec<i64> = (1..=100000).collect();
let int64_array = Int64Array::from(int_values);
let list_array = Arc::new(int64_array) as ArrayRef;
// Use sequential indices from 0 to 99,999
let indices = Int64Array::from((0..100000).collect::<Vec<i64>>());
let result = repeat_arrs_from_indices(&[list_array], &indices);
println!("{:?}", result);
assert_eq!(1, 1);
}
```
finished in 0.00s
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Overflow in Join Processing for Large Ranges [datafusion]
Posted by "Dandandan (via GitHub)" <gi...@apache.org>.
Dandandan commented on issue #13237:
URL: https://github.com/apache/datafusion/issues/13237#issuecomment-2465140518
Yeah, this doesn't seem like a problem with join but rather a problem with `repeat_arrs_from_indices` and use of `take`
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Overflow in Join Processing for Large Ranges [datafusion]
Posted by "demetribu (via GitHub)" <gi...@apache.org>.
demetribu commented on issue #13237:
URL: https://github.com/apache/datafusion/issues/13237#issuecomment-2464989919
Exception raised [here](https://github.com/apache/datafusion/blob/f190fc6de6a6171c1cd6aa99233bc647ed8b1377/datafusion/physical-plan/src/unnest.rs#L899)
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Overflow in `repeat_arrs_from_indices` [datafusion]
Posted by "Dandandan (via GitHub)" <gi...@apache.org>.
Dandandan commented on issue #13237:
URL: https://github.com/apache/datafusion/issues/13237#issuecomment-2465484556
Sorry, can you point out the difference between the code snippets?
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Overflow in `repeat_arrs_from_indices` [datafusion]
Posted by "Dandandan (via GitHub)" <gi...@apache.org>.
Dandandan commented on issue #13237:
URL: https://github.com/apache/datafusion/issues/13237#issuecomment-2465485386
Ah largelistbuilder vs listbuilder
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Overflow in `repeat_arrs_from_indices` [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #13237: Overflow in `repeat_arrs_from_indices`
URL: https://github.com/apache/datafusion/issues/13237
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org