Handle empty offsets buffer (#1824)#2836
Conversation
| /// Returns a slice of `OffsetSize` consisting of a single zero value | ||
| #[inline] | ||
| pub(crate) fn empty_offsets<OffsetSize: OffsetSizeTrait>() -> &'static [OffsetSize] { | ||
| static OFFSET: &[i64] = &[0]; |
There was a problem hiding this comment.
This slightly odd construction is necessary to workaround the fact Rust doesn't allow statics that depend on type parameters. It gets const folded away by the compiler
|
This looks like a nice trick 👍 |
| .unwrap(), | ||
| ); | ||
| assert_eq!(string.value_offsets(), &[0]); | ||
| let string = LargeBinaryArray::from( |
There was a problem hiding this comment.
| let string = LargeBinaryArray::from( | |
| let string = LargeBinaryArray::from( | |
| assert_eq!(string.len(), 0); |
I suggest you add a test for len() as described in the original bug report.
This comment applies to all the tests added in this PR
|
Benchmark runs are scheduled for baseline = f8254e7 and contender = f4ee8b9. f4ee8b9 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Which issue does this PR close?
Closes #1824
Rationale for this change
What changes are included in this PR?
Are there any user-facing changes?
No