Skip to content

Commit 55f5d68

Browse files
authored
Bump columnar to 0.8.0 (#620)
* Bump columnar to 0.8.0 Signed-off-by: Moritz Hoffmann <[email protected]> * Update example to columnar 0.8.0 Signed-off-by: Moritz Hoffmann <[email protected]> --------- Signed-off-by: Moritz Hoffmann <[email protected]>
1 parent 8ab6a09 commit 55f5d68

File tree

3 files changed

+32
-24
lines changed

3 files changed

+32
-24
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ resolver = "2"
1818
[workspace.dependencies]
1919
differential-dataflow = { path = "differential-dataflow", default-features = false, version = "0.15.3" }
2020
timely = { version = "0.21", default-features = false }
21+
columnar = { version = "0.8", default-features = false }
2122
#timely = { path = "../timely-dataflow/timely/", default-features = false }
2223

2324
[profile.release]

differential-dataflow/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ graph_map = "0.1"
2323
bytemuck = "1.18.0"
2424

2525
[dependencies]
26-
columnar = "0.6"
26+
columnar = { workspace = true }
2727
columnation = "0.1.0"
2828
fnv="1.0.2"
2929
paste = "1.0"

differential-dataflow/examples/columnar.rs

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,17 @@ mod container {
156156
use columnar::bytes::{EncodeDecode, Indexed};
157157
use columnar::common::IterOwn;
158158

159+
type BorrowedOf<'a, C> = <<C as Columnar>::Container as columnar::Container>::Borrowed<'a>;
160+
159161
impl<C: Columnar> Column<C> {
160-
pub fn borrow(&self) -> <C::Container as columnar::Container<C>>::Borrowed<'_> {
162+
pub fn borrow(&self) -> BorrowedOf<C> {
161163
match self {
162164
Column::Typed(t) => t.borrow(),
163-
Column::Bytes(b) => <<C::Container as columnar::Container<C>>::Borrowed<'_> as FromBytes>::from_bytes(&mut Indexed::decode(bytemuck::cast_slice(b))),
164-
Column::Align(a) => <<C::Container as columnar::Container<C>>::Borrowed<'_> as FromBytes>::from_bytes(&mut Indexed::decode(a)),
165+
Column::Bytes(b) => <BorrowedOf<C> as FromBytes>::from_bytes(&mut Indexed::decode(bytemuck::cast_slice(b))),
166+
Column::Align(a) => <BorrowedOf<C> as FromBytes>::from_bytes(&mut Indexed::decode(a)),
165167
}
166168
}
167-
pub fn get(&self, index: usize) -> C::Ref<'_> {
169+
pub fn get(&self, index: usize) -> columnar::Ref<C> {
168170
self.borrow().get(index)
169171
}
170172
}
@@ -174,8 +176,8 @@ mod container {
174176
fn len(&self) -> usize {
175177
match self {
176178
Column::Typed(t) => t.len(),
177-
Column::Bytes(b) => <<C::Container as columnar::Container<C>>::Borrowed<'_> as FromBytes>::from_bytes(&mut Indexed::decode(bytemuck::cast_slice(b))).len(),
178-
Column::Align(a) => <<C::Container as columnar::Container<C>>::Borrowed<'_> as FromBytes>::from_bytes(&mut Indexed::decode(a)).len(),
179+
Column::Bytes(b) => <BorrowedOf<C> as FromBytes>::from_bytes(&mut Indexed::decode(bytemuck::cast_slice(b))).len(),
180+
Column::Align(a) => <BorrowedOf<C> as FromBytes>::from_bytes(&mut Indexed::decode(a)).len(),
179181
}
180182
}
181183
// This sets the `Bytes` variant to be an empty `Typed` variant, appropriate for pushing into.
@@ -187,23 +189,23 @@ mod container {
187189
}
188190
}
189191

190-
type ItemRef<'a> = C::Ref<'a>;
191-
type Iter<'a> = IterOwn<<C::Container as columnar::Container<C>>::Borrowed<'a>>;
192+
type ItemRef<'a> = columnar::Ref<'a, C>;
193+
type Iter<'a> = IterOwn<BorrowedOf<'a, C>>;
192194
fn iter<'a>(&'a self) -> Self::Iter<'a> {
193195
match self {
194196
Column::Typed(t) => t.borrow().into_index_iter(),
195-
Column::Bytes(b) => <<C::Container as columnar::Container<C>>::Borrowed<'a> as FromBytes>::from_bytes(&mut Indexed::decode(bytemuck::cast_slice(b))).into_index_iter(),
196-
Column::Align(a) => <<C::Container as columnar::Container<C>>::Borrowed<'a> as FromBytes>::from_bytes(&mut Indexed::decode(a)).into_index_iter(),
197+
Column::Bytes(b) => <BorrowedOf<C> as FromBytes>::from_bytes(&mut Indexed::decode(bytemuck::cast_slice(b))).into_index_iter(),
198+
Column::Align(a) => <BorrowedOf<C> as FromBytes>::from_bytes(&mut Indexed::decode(a)).into_index_iter(),
197199
}
198200
}
199201

200-
type Item<'a> = C::Ref<'a>;
201-
type DrainIter<'a> = IterOwn<<C::Container as columnar::Container<C>>::Borrowed<'a>>;
202+
type Item<'a> = columnar::Ref<'a, C>;
203+
type DrainIter<'a> = IterOwn<BorrowedOf<'a, C>>;
202204
fn drain<'a>(&'a mut self) -> Self::DrainIter<'a> {
203205
match self {
204206
Column::Typed(t) => t.borrow().into_index_iter(),
205-
Column::Bytes(b) => <<C::Container as columnar::Container<C>>::Borrowed<'a> as FromBytes>::from_bytes(&mut Indexed::decode(bytemuck::cast_slice(b))).into_index_iter(),
206-
Column::Align(a) => <<C::Container as columnar::Container<C>>::Borrowed<'a> as FromBytes>::from_bytes(&mut Indexed::decode(a)).into_index_iter(),
207+
Column::Bytes(b) => <BorrowedOf<C> as FromBytes>::from_bytes(&mut Indexed::decode(bytemuck::cast_slice(b))).into_index_iter(),
208+
Column::Align(a) => <BorrowedOf<C> as FromBytes>::from_bytes(&mut Indexed::decode(a)).into_index_iter(),
207209
}
208210
}
209211
}
@@ -406,10 +408,13 @@ pub mod batcher {
406408

407409
impl<'a, D, T, R, C2> PushInto<&'a mut Column<(D, T, R)>> for Chunker<C2>
408410
where
409-
D: for<'b> Columnar<Ref<'b>: Ord>,
410-
T: for<'b> Columnar<Ref<'b>: Ord>,
411-
R: for<'b> Columnar<Ref<'b>: Ord> + for<'b> Semigroup<R::Ref<'b>>,
412-
C2: Container + for<'b, 'c> PushInto<(D::Ref<'b>, T::Ref<'b>, &'c R)>,
411+
D: for<'b> Columnar,
412+
for<'b> columnar::Ref<'b, D>: Ord,
413+
T: for<'b> Columnar,
414+
for<'b> columnar::Ref<'b, T>: Ord,
415+
R: for<'b> Columnar + for<'b> Semigroup<columnar::Ref<'b, R>>,
416+
for<'b> columnar::Ref<'b, R>: Ord,
417+
C2: Container + for<'b, 'c> PushInto<(columnar::Ref<'b, D>, columnar::Ref<'b, T>, &'c R)>,
413418
{
414419
fn push_into(&mut self, container: &'a mut Column<(D, T, R)>) {
415420

@@ -482,11 +487,13 @@ pub mod batcher {
482487

483488
impl<D, T, R> ContainerQueue<Column<(D, T, R)>> for ColumnQueue<(D, T, R)>
484489
where
485-
D: for<'a> Columnar<Ref<'a>: Ord>,
486-
T: for<'a> Columnar<Ref<'a>: Ord>,
490+
D: for<'a> Columnar,
491+
for<'b> columnar::Ref<'b, D>: Ord,
492+
T: for<'a> Columnar,
493+
for<'b> columnar::Ref<'b, T>: Ord,
487494
R: Columnar,
488495
{
489-
fn next_or_alloc(&mut self) -> Result<<(D, T, R) as Columnar>::Ref<'_>, Column<(D, T, R)>> {
496+
fn next_or_alloc(&mut self) -> Result<columnar::Ref<(D, T, R)>, Column<(D, T, R)>> {
490497
if self.is_empty() {
491498
Err(std::mem::take(&mut self.list))
492499
}
@@ -510,12 +517,12 @@ pub mod batcher {
510517
}
511518

512519
impl<T: Columnar> ColumnQueue<T> {
513-
fn pop(&mut self) -> T::Ref<'_> {
520+
fn pop(&mut self) -> columnar::Ref<T> {
514521
self.head += 1;
515522
self.list.get(self.head - 1)
516523
}
517524

518-
fn peek(&self) -> T::Ref<'_> {
525+
fn peek(&self) -> columnar::Ref<T> {
519526
self.list.get(self.head)
520527
}
521528
}

0 commit comments

Comments
 (0)