Skip to content

Commit 85f364a

Browse files
committed
don't serialize sortedness flags
1 parent 228894d commit 85f364a

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

src/array.rs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ enum ArrayRep<T: ArrayValueSer> {
13061306

13071307
impl<T: ArrayValueSer> From<ArrayRep<T>> for Array<T> {
13081308
fn from(rep: ArrayRep<T>) -> Self {
1309-
match rep {
1309+
let mut arr = match rep {
13101310
ArrayRep::Scalar(data) => Self::new([], [data.into()]),
13111311
ArrayRep::List(data) => {
13121312
let data = T::make_data(data);
@@ -1326,7 +1326,30 @@ impl<T: ArrayValueSer> From<ArrayRep<T>> for Array<T> {
13261326
let data = T::make_data(data);
13271327
Self { shape, data, meta }
13281328
}
1329+
};
1330+
1331+
// Update sortedness flags
1332+
let mut is_sorted_up = true;
1333+
let mut is_sorted_down = true;
1334+
{
1335+
let mut rows = arr.row_slices();
1336+
if let Some(mut curr) = rows.next() {
1337+
for row in rows {
1338+
if !is_sorted_up && !is_sorted_down {
1339+
break;
1340+
}
1341+
match ArrayCmpSlice(curr).cmp(&ArrayCmpSlice(row)) {
1342+
Ordering::Equal => {}
1343+
Ordering::Less => is_sorted_down = false,
1344+
Ordering::Greater => is_sorted_up = false,
1345+
}
1346+
curr = row;
1347+
}
1348+
}
13291349
}
1350+
arr.meta.mark_sorted_up(is_sorted_up);
1351+
arr.meta.mark_sorted_down(is_sorted_down);
1352+
arr
13301353
}
13311354
}
13321355

@@ -1343,7 +1366,7 @@ impl<T: ArrayValueSer> From<Array<T>> for ArrayRep<T> {
13431366
} else {
13441367
inner.map_keys = map_keys;
13451368
}
1346-
inner.flags &= !ArrayFlags::BOOLEAN;
1369+
inner.flags = ArrayFlags::empty();
13471370
if inner != DEFAULT_META_INNER {
13481371
return ArrayRep::Full(
13491372
arr.shape,

todo.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
- Fix goto references
77
- `Variants` field for module
88
- Don't serialize sortedness flags
9-
- Sided `fork`
109
- Sided `join`
1110
- `table` subscripts for rank selection
1211
- Mixed subscripts
1312
- `bracket`
1413
- Reserved modifier glyphs?
15-
- Implement some `under` inverses in terms of `un by`, rather than the other way around?
1614
- `un`/`anti` `stencil`
1715
- Compile-time code string evaluation?
1816
- Streaming gif and audio encoding

0 commit comments

Comments
 (0)