Skip to content

Commit 41fb595

Browse files
committed
DPL Analysis: add exception for unsorted unassigned groups
If unassigned groups are in incorrect order (or split), fast grouping is invalid due to incorrect offsets, so the execution should stop.
1 parent 3032766 commit 41fb595

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

Framework/Core/include/Framework/Kernels.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,23 @@ auto sliceByColumn(
8181
for (auto i = 0; i < column->num_chunks(); ++i) {
8282
T prev = 0;
8383
T cur = 0;
84+
T nprev = -1;
8485
auto array = static_cast<arrow::NumericArray<typename detail::ConversionTraits<T>::ArrowType>>(column->chunk(i)->data());
8586
for (auto e = 0; e < array.length(); ++e) {
8687
if (cur >= 0) {
8788
prev = cur;
89+
} else {
90+
nprev = cur;
8891
}
8992
cur = array.Value(e);
90-
if (cur >= 0 && prev > cur) {
91-
throw runtime_error_f("Table %s index %s is not sorted: next value %d < previous value %d!", target, key, cur, prev);
93+
if (cur >= 0) {
94+
if (prev > cur) {
95+
throw runtime_error_f("Table %s index %s is not sorted: next value %d < previous value %d!", target, key, cur, prev);
96+
}
97+
} else {
98+
if (nprev < cur) {
99+
throw runtime_error_f("Table %s index %s is not sorted: next negative value %d > previous negative value %d!", target, key, cur, nprev);
100+
}
92101
}
93102
}
94103
}

0 commit comments

Comments
 (0)