alamb commented on code in PR #13758:
URL: https://github.com/apache/datafusion/pull/13758#discussion_r1884044302
##########
datafusion/functions/src/strings.rs:
##########
@@ -335,7 +335,27 @@ impl LargeStringArrayBuilder {
unsafe { self.offsets_buffer.push_unchecked(next_offset) };
}
+ /// Finalise the builder into a concrete [`LargeStringArray`].
+ ///
+ /// # Panics
+ ///
+ /// This method can panic when:
+ ///
+ /// - the provided `null_buffer` is not the same length as the
`offsets_buffer`.
+ /// - the provided `null_buffer` is not the same length as the
`value_buffer`.
pub fn finish(self, null_buffer: Option<NullBuffer>) -> LargeStringArray {
+ if let Some(ref null_buffer) = null_buffer {
+ assert_eq!(
+ null_buffer.len(),
+ self.offsets_buffer.len() / size_of::<i64>() - 1,
+ "Null buffer and offsets buffer must be the same length"
+ );
+ assert_eq!(
Review Comment:
I think I have lead you astray in my suggestion -- I don't think the
value_buffer (that stores the string data) will be the same length and since it
stores variable length data I don't think we will know what the lenght should be
Thus I think we should remove this second assert (as it will likely fail)
--
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]