You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "liningpan (via GitHub)" <gi...@apache.org> on 2026/07/21 16:03:24 UTC
[I] Incorrect size estimate for base64 decode buffer for BinaryView [datafusion]
liningpan opened a new issue, #23763:
URL: https://github.com/apache/datafusion/issues/23763
### Describe the bug
The upper bound of the output buffer size for binary view is estimated using its memory buffer size.
https://github.com/apache/datafusion/blob/050046a7f0c08d64d8dba9ebf0e3544cbda6cd38/datafusion/functions/src/encoding/inner.rs#L297
This is incorrect as it can underestimate required memory when the BinaryView contains significant duplication and views point to overlapping regions in the buffers.
base64 decode will fail with `Output slice too small` due to this bad estimate.
### To Reproduce
The following test case could trigger this bug
`datafusion/datafusion/functions/src/encoding/inner.rs`
```rust
#[test]
fn test_estimate_view_size() {
let mut builder = BinaryViewBuilder::new().with_deduplicate_strings();
for _ in 0..1000 {
builder.append_value([65u8; 64]);
}
let arr = ArrayBuilder::finish(&mut builder);
println!("{}", arr.get_buffer_memory_size());
Encoding::Base64Padded
.decode_array::<_, i32>(&arr.as_binary_view(), arr.get_buffer_memory_size())
.unwrap();
}
```
### Expected behavior
_No response_
### Additional context
This bug might have a much larger blast radius.
--
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] Incorrect size estimate for base64 decode buffer for BinaryView [datafusion]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey closed issue #23763: Incorrect size estimate for base64 decode buffer for BinaryView
URL: https://github.com/apache/datafusion/issues/23763
--
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] Incorrect size estimate for base64 decode buffer for BinaryView [datafusion]
Posted by "liningpan (via GitHub)" <gi...@apache.org>.
liningpan commented on issue #23763:
URL: https://github.com/apache/datafusion/issues/23763#issuecomment-5036302338
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